Skip to content

Commit 50f5476

Browse files
committed
ci/cd update: eks nodes config fix tryout
1 parent f3ab2cf commit 50f5476

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/deploy-pipeline.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,62 @@ jobs:
456456
echo "Please create node groups manually in the AWS console"
457457
}
458458
fi
459+
460+
# Check if node group exists and is active
461+
echo "🔍 Verifying node group status..."
462+
NODEGROUP_STATUS=$(aws eks describe-nodegroup \
463+
--cluster-name $EKS_CLUSTER_NAME \
464+
--nodegroup-name "$EKS_CLUSTER_NAME-node-group" \
465+
--region $AWS_REGION \
466+
--query 'nodegroup.status' \
467+
--output text 2>/dev/null || echo "NOT_FOUND")
468+
469+
if [ "$NODEGROUP_STATUS" = "NOT_FOUND" ] || [ "$NODEGROUP_STATUS" != "ACTIVE" ]; then
470+
echo "⚠️ Node group not found or not active (status: $NODEGROUP_STATUS)"
471+
echo "🔧 Forcing Terraform apply to create/update node group..."
472+
473+
cd infra
474+
terraform apply -auto-approve \
475+
-var="aws_region=${{ secrets.AWS_REGION }}" \
476+
-var="s3_bucket_name=ml-crash-course-data" \
477+
-var="eks_cluster_name=ml-crash-course-cluster"
478+
479+
echo "⏳ Waiting for node group to be active..."
480+
aws eks wait nodegroup-active \
481+
--cluster-name $EKS_CLUSTER_NAME \
482+
--nodegroup-name "$EKS_CLUSTER_NAME-node-group" \
483+
--region $AWS_REGION || {
484+
echo "⚠️ Node group not ready yet, but continuing..."
485+
}
486+
487+
cd ..
488+
else
489+
echo "✅ Node group is active (status: $NODEGROUP_STATUS)"
490+
fi
491+
492+
# Wait for nodes to be ready
493+
echo "⏳ Waiting for nodes to be ready..."
494+
MAX_ATTEMPTS=30
495+
ATTEMPT=0
496+
497+
while [ $ATTEMPT -lt $MAX_ATTEMPTS ]; do
498+
READY_NODES=$(kubectl get nodes --no-headers | grep -c "Ready")
499+
TOTAL_NODES=$(kubectl get nodes --no-headers | wc -l)
500+
501+
echo "📊 Node status: $READY_NODES/$TOTAL_NODES nodes ready (attempt $((ATTEMPT+1))/$MAX_ATTEMPTS)"
502+
503+
if [ $READY_NODES -gt 0 ]; then
504+
echo "✅ Nodes are ready!"
505+
break
506+
fi
507+
508+
ATTEMPT=$((ATTEMPT+1))
509+
sleep 30
510+
done
511+
512+
if [ $ATTEMPT -eq $MAX_ATTEMPTS ]; then
513+
echo "⚠️ Timeout waiting for nodes to be ready, but continuing..."
514+
fi
459515
- name: Set up Helm
460516
uses: azure/setup-helm@v3
461517
- name: Deploy Airflow via Helm
@@ -644,10 +700,30 @@ jobs:
644700
echo "📊 Available nodes:"
645701
kubectl get nodes
646702
703+
# Check EKS node group status
704+
echo "🔍 Checking EKS node group status..."
705+
aws eks describe-nodegroup \
706+
--cluster-name $EKS_CLUSTER_NAME \
707+
--nodegroup-name "$EKS_CLUSTER_NAME-node-group" \
708+
--region $AWS_REGION || {
709+
echo "❌ Node group not found or not accessible"
710+
echo "🔍 Listing all node groups:"
711+
aws eks list-nodegroups --cluster-name $EKS_CLUSTER_NAME --region $AWS_REGION || echo "No node groups found"
712+
}
713+
714+
# Check if nodes are joining the cluster
715+
echo "🔍 Checking if nodes are joining the cluster..."
716+
kubectl get nodes -o wide
717+
647718
if [ "$READY_PODS" -gt 0 ]; then
648719
echo "✅ Model API deployment is progressing"
649720
else
650721
echo "⚠️ Model API pods not ready yet - checking for scheduling issues"
722+
echo "🔍 This might be due to:"
723+
echo " 1. Node group not created yet"
724+
echo " 2. Nodes not ready to accept pods"
725+
echo " 3. Insufficient resources"
726+
echo " 4. Network connectivity issues"
651727
fi
652728
- name: Wait for deployments to be ready
653729
run: |

0 commit comments

Comments
 (0)