Skip to content

Commit ab9fd96

Browse files
author
gurekam
committed
LAP-30: Update GitHub Actions workflow to explicitly use EKS cluster
1 parent cdd2264 commit ab9fd96

File tree

2 files changed

+24
-27
lines changed

2 files changed

+24
-27
lines changed

.github/workflows/deploy.yml

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,26 @@ jobs:
4646
if: steps.check-cluster.outputs.cluster_exists == 'false'
4747
run: eksctl create cluster -f kubernetes/eks-cluster.yaml
4848

49-
- name: Update kubeconfig
50-
run: aws eks update-kubeconfig --name ${{ env.EKS_CLUSTER_NAME }} --region ${{ env.AWS_REGION }}
51-
52-
- name: Install nginx ingress controller
49+
- name: Update kubeconfig and set context
5350
run: |
54-
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
55-
helm repo update
56-
helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx \
57-
--namespace ingress-nginx \
58-
--create-namespace \
59-
--set controller.service.type=LoadBalancer
51+
aws eks update-kubeconfig --name ${{ env.EKS_CLUSTER_NAME }} --region ${{ env.AWS_REGION }}
52+
kubectl config use-context arn:aws:eks:${{ env.AWS_REGION }}:${{ secrets.AWS_ACCOUNT_ID }}:cluster/${{ env.EKS_CLUSTER_NAME }}
53+
kubectl config current-context
6054
6155
- name: Deploy application
6256
run: |
57+
# Create namespace if it doesn't exist
6358
kubectl create namespace spreadsheet-app --dry-run=client -o yaml | kubectl apply -f -
59+
60+
# Deploy Redis
6461
kubectl apply -f kubernetes/redis.yaml
62+
63+
# Deploy main application
6564
kubectl apply -f kubernetes/deployment.yaml
65+
66+
# Deploy ingress
6667
kubectl apply -f kubernetes/ingress.yaml
67-
68-
- name: Get Application URL
69-
run: |
70-
echo "Waiting for ingress to be ready..."
71-
sleep 30
72-
INGRESS_HOST=$(kubectl get svc -n ingress-nginx ingress-nginx-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')
73-
echo "Application URL: http://$INGRESS_HOST"
74-
echo "url=http://$INGRESS_HOST" >> $GITHUB_OUTPUT
68+
69+
# Wait for pods to be ready
70+
kubectl wait --for=condition=ready pod -l app=spreadsheet-app -n spreadsheet-app --timeout=300s
71+
kubectl wait --for=condition=ready pod -l app=redis -n spreadsheet-app --timeout=300s

kubernetes/ingress.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ metadata:
77
nginx.ingress.kubernetes.io/rewrite-target: /
88
spec:
99
rules:
10-
- http:
11-
paths:
12-
- path: /
13-
pathType: Prefix
14-
backend:
15-
service:
16-
name: spreadsheet-app-service
17-
port:
18-
number: 80
10+
- http:
11+
paths:
12+
- path: /
13+
pathType: Prefix
14+
backend:
15+
service:
16+
name: spreadsheet-app-service
17+
port:
18+
number: 80

0 commit comments

Comments
 (0)