From dffb04774f81cd0a9e2459c411eb75cde8b705d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Rost=C3=A1s?= Date: Sat, 19 Sep 2020 02:15:35 +0200 Subject: [PATCH] feat: make wait-for-cluster more robust (#676) The status is PROVISIONING at the beginning, thus the original logic will always exit and say "Cluster is ready!". If we wait for the RUNNING status, we will know for sure the cluster is up. Co-authored-by: Bharath KKB --- autogen/main/scripts/wait-for-cluster.sh | 2 +- .../scripts/wait-for-cluster.sh | 2 +- modules/beta-private-cluster/scripts/wait-for-cluster.sh | 2 +- .../scripts/wait-for-cluster.sh | 2 +- modules/beta-public-cluster/scripts/wait-for-cluster.sh | 2 +- .../private-cluster-update-variant/scripts/wait-for-cluster.sh | 2 +- modules/private-cluster/scripts/wait-for-cluster.sh | 2 +- scripts/wait-for-cluster.sh | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/autogen/main/scripts/wait-for-cluster.sh b/autogen/main/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/autogen/main/scripts/wait-for-cluster.sh +++ b/autogen/main/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh b/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh +++ b/modules/beta-private-cluster-update-variant/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/modules/beta-private-cluster/scripts/wait-for-cluster.sh b/modules/beta-private-cluster/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/modules/beta-private-cluster/scripts/wait-for-cluster.sh +++ b/modules/beta-private-cluster/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/modules/beta-public-cluster-update-variant/scripts/wait-for-cluster.sh b/modules/beta-public-cluster-update-variant/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/modules/beta-public-cluster-update-variant/scripts/wait-for-cluster.sh +++ b/modules/beta-public-cluster-update-variant/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/modules/beta-public-cluster/scripts/wait-for-cluster.sh b/modules/beta-public-cluster/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/modules/beta-public-cluster/scripts/wait-for-cluster.sh +++ b/modules/beta-public-cluster/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh b/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh +++ b/modules/private-cluster-update-variant/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/modules/private-cluster/scripts/wait-for-cluster.sh b/modules/private-cluster/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/modules/private-cluster/scripts/wait-for-cluster.sh +++ b/modules/private-cluster/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!" diff --git a/scripts/wait-for-cluster.sh b/scripts/wait-for-cluster.sh index 9636eeec1..16c395223 100755 --- a/scripts/wait-for-cluster.sh +++ b/scripts/wait-for-cluster.sh @@ -27,7 +27,7 @@ echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..." while current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)") - [[ "${current_status}" == "RECONCILING" ]] + [[ "${current_status}" != "RUNNING" ]] do printf ".";sleep 5; done echo "Cluster is ready!"