Skip to content

Commit 3d3af56

Browse files
committed
fix: When delete in getting-started and various improvements
1 parent 25044bd commit 3d3af56

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

lab/bin/reset-environment

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ if [ -z "$EKS_DEFAULT_MNG_MIN" ]; then
3939
fi
4040

4141
rm -f /home/ec2-user/.kube/config
42+
EKS_CLUSTER_AUTO_NAME=${EKS_CLUSTER_AUTO_NAME:-"eks-workshop-auto"}
4243

44+
aws eks update-kubeconfig --name $EKS_CLUSTER_AUTO_NAME --alias eks-workshop-auto
4345
aws eks update-kubeconfig --name $EKS_CLUSTER_NAME --alias default --user-alias default
4446

4547
module=$1
@@ -89,10 +91,6 @@ if [ ! -z "$module" ]; then
8991
curl --get -s --data-urlencode "lab=$module" --data-urlencode "account_id=$AWS_ACCOUNT_ID" $ANALYTICS_ENDPOINT || true
9092
fi
9193

92-
if [ $module = "introduction/getting-started" ]; then
93-
exit
94-
fi
95-
9694
if [[ "$module" = "fastpaths/"* ]]; then
9795
kubectl config use-context eks-workshop-auto
9896
exit
@@ -126,7 +124,9 @@ kubectl delete namespace other --ignore-not-found --timeout=60s || {
126124
fi
127125
}
128126

129-
if [[ $module != introduction/basics* ]]; then
127+
if [[ $module = introduction/basics* || $module = introduction/getting-started* ]]; then
128+
kubectl delete -k $base_path --ignore-not-found
129+
else
130130
kubectl apply -k $base_path --prune --all \
131131
--prune-allowlist=autoscaling/v1/HorizontalPodAutoscaler \
132132
--prune-allowlist=core/v1/Service \
@@ -146,8 +146,6 @@ if [[ $module != introduction/basics* ]]; then
146146
kubectl wait --for=condition=available --timeout=240s deployments -l app.kubernetes.io/created-by=eks-workshop -A
147147
kubectl wait --for=condition=Ready --timeout=240s pods -l app.kubernetes.io/created-by=eks-workshop -A
148148

149-
else
150-
kubectl delete -k $base_path --ignore-not-found
151149
fi
152150

153151
# Addons
@@ -173,7 +171,14 @@ terraform -chdir="$tf_dir" destroy --auto-approve
173171

174172
rm -rf /eks-workshop/hooks
175173

174+
# Cleanup done, let's install the right item
175+
176176
if [ ! -z "$module" ]; then
177+
if [ $module = "introduction/getting-started" ]; then
178+
# This module doesn't need anything installed
179+
exit
180+
fi
181+
177182
module_path="$manifests_path/modules/$module"
178183

179184
if [ -f "$module_path/.workshop/cleanup.sh" ]; then

0 commit comments

Comments
 (0)