gha: k8s: Ensure cluster doesn't exist before creating it

The cluster cleanup step will sometimes fail to run, meaning the next
run would fail in the cluster creation step. This PR addresses that.

Example: https://github.com/kata-containers/kata-containers/actions/runs/5349582743/jobs/9867845852

Fixes: #7242

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
Aurélien Bombo 2023-07-05 14:45:09 -07:00
parent a25d5b9807
commit c45f646b9d

View File

@ -31,6 +31,9 @@ function login_azure() {
}
function create_cluster() {
# First, ensure that the cluster didn't fail to get cleaned up from a previous run.
delete_cluster || true
az aks create \
-g "kataCI" \
-n "$(_print_cluster_name)" \
@ -115,8 +118,7 @@ function delete_cluster() {
az aks delete \
-g "kataCI" \
-n "$(_print_cluster_name)" \
--yes \
--no-wait
--yes
}
function main() {