Skip to content

Commit

Permalink
feat: add waiting on machine pool removal
Browse files Browse the repository at this point in the history
  • Loading branch information
matihost committed Nov 23, 2024
1 parent 95d8d41 commit 06532d5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions terraform/aws/aws-rosa/module/delete-machine-pools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,17 @@ for pool in $MACHINE_POOLS; do
rosa delete machinepool -c "${CLUSTER_ID}" "${pool}" -y
fi
done

max_wait=$((30 * 60))
elapsed=0
interval=10

while [[ "$(rosa list machinepools -c "${CLUSTER_ID}" -o json | jq -r '.[].id' | grep -c "^${MACHINE_POOL_PREFIX}")" -ne 0 ]]; do
echo "Waiting for ${MACHINE_POOL_PREFIX} to disappear... ($elapsed seconds elapsed)"
sleep "${interval}"
elapsed=$((elapsed + interval))
if ((elapsed >= max_wait)); then
echo "Timeout reached after 30 minutes... ${MACHINE_POOL_PREFIX} still exist in the cluster "
exit 1
fi
done

0 comments on commit 06532d5

Please sign in to comment.