mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-29 13:24:42 +00:00
Make MIG deletion during GCE kube down blocking, so that subseqent template deletion doesn't fail.
This commit is contained in:
parent
04c90565c0
commit
c5b1508774
@ -644,10 +644,24 @@ function kube-down {
|
|||||||
|
|
||||||
echo "Bringing down cluster"
|
echo "Bringing down cluster"
|
||||||
|
|
||||||
gcloud preview managed-instance-groups --zone "${ZONE}" delete \
|
deleteCmdOutput=$(gcloud preview managed-instance-groups --zone "${ZONE}" delete \
|
||||||
--project "${PROJECT}" \
|
--project "${PROJECT}" \
|
||||||
--quiet \
|
--quiet \
|
||||||
"${NODE_INSTANCE_PREFIX}-group" || true
|
"${NODE_INSTANCE_PREFIX}-group" || true)
|
||||||
|
if [[ "$deleteCmdOutput" != "" ]]; then
|
||||||
|
# Managed instance group deletion is done asyncronously, we must wait for it to complete, or subsequent steps fail
|
||||||
|
deleteCmdOperationId=$(echo $deleteCmdOutput | grep "Operation:" | sed "s/.*Operation:\s//" | sed "s/\s.*//" | sed "s/ //g")
|
||||||
|
if [[ "$deleteCmdOperationId" != "" ]]; then
|
||||||
|
deleteCmdStatus="PENDING"
|
||||||
|
while [[ "$deleteCmdStatus" != "DONE" ]]
|
||||||
|
do
|
||||||
|
sleep 5
|
||||||
|
deleteCmdOperationOutput=$(gcloud preview managed-instance-groups --zone "${ZONE}" get-operation $deleteCmdOperationId)
|
||||||
|
deleteCmdStatus=$(echo $deleteCmdOperationOutput | grep -i "status:" | sed "s/.*status:\s//" | sed "s/\s.*//" | sed "s/ //g")
|
||||||
|
echo "Waiting for MIG deletion to complete. Current status: " $deleteCmdStatus
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
gcloud compute instance-templates delete \
|
gcloud compute instance-templates delete \
|
||||||
--project "${PROJECT}" \
|
--project "${PROJECT}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user