Skip to content

Commit

Permalink
fix: Improve reliability of custom networking cleanup (#1118)
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson authored Sep 28, 2024
1 parent 635eccd commit 0b78581
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

logmessage "WARNING! This lab takes additional time to clean up to ensure lab stability, please be patient"
logmessage "WARNING! This lab takes additional time to clean up to ensure workshop stability, please be patient"

logmessage "Deleting ENI configs..."

Expand All @@ -16,6 +16,8 @@ kubectl set env daemonset aws-node -n kube-system AWS_VPC_K8S_CNI_CUSTOM_NETWORK

sleep 10

kubectl delete namespace checkout

logmessage "Terminating EKS worker nodes..."

INSTANCE_IDS=$(aws autoscaling describe-auto-scaling-groups --filters "Name=tag:eks:nodegroup-name,Values=$EKS_DEFAULT_MNG_NAME" "Name=tag:eks:cluster-name,Values=$EKS_CLUSTER_NAME" --query 'AutoScalingGroups[0].Instances[].InstanceId' --output text)
Expand All @@ -25,8 +27,6 @@ do
aws ec2 terminate-instances --instance-ids $INSTANCE_ID
done

sleep 30

custom_nodegroup=$(aws eks list-nodegroups --cluster-name $EKS_CLUSTER_NAME --query "nodegroups[? @ == 'custom-networking']" --output text)

if [ ! -z "$custom_nodegroup" ]; then
Expand All @@ -35,3 +35,7 @@ if [ ! -z "$custom_nodegroup" ]; then
aws eks delete-nodegroup --region $AWS_REGION --cluster-name $EKS_CLUSTER_NAME --nodegroup-name custom-networking
aws eks wait nodegroup-deleted --cluster-name $EKS_CLUSTER_NAME --nodegroup-name custom-networking
fi

sleep 30

kubectl wait --for=condition=Ready --timeout=15m pods -l app.kubernetes.io/created-by=eks-workshop -A

0 comments on commit 0b78581

Please sign in to comment.