fix cleanup_bootstrap_cluster when run from apply.sh

The bootstrap cluster deletion attempted at the end of apply.sh cannot work today:

In my dev env (where bootstrap.sh hadn't run until completion):

🗑 Delete bootstrap cluster
Error from server (NotFound): jobs.batch "pivot" not found
Cannot delete bootstrap cluster as 'pivot' Kustomization is not ready.
To delete the bootstrap cluster, you can re-run apply.sh anytime after fixing this.

with a set -vx, I get:

🗑 Delete bootstrap cluster
+ kubectl wait job '--for=jsonpath={.status.succeeded}=1' pivot
Error from server (NotFound): jobs.batch "pivot" not found
+ echo 'Cannot delete bootstrap cluster as '\''pivot'\'' Kustomization is not ready.'
Cannot delete bootstrap cluster as 'pivot' Kustomization is not ready.
+ echo 'To delete the bootstrap cluster, you can re-run apply.sh anytime after fixing this.'
To delete the bootstrap cluster, you can re-run apply.sh anytime after fixing this.
+ exit 1

The cleanup_bootstrap_cluster, when called from apply.sh, needs to unset KUBECONFIG so that the test command can be mode on the bootstrap cluster.

(tested locally because this cannot be tested in CI, we don't have the case where bootstrap.sh hadn't run until completion and we run apply.sh afterwards)

/cc @daniel.anton

Edited by Thomas Morin

Merge request reports

Loading