Skip to content

Commit

Permalink
fix: multiple cluster wait-for-cluster.sh (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb committed Nov 3, 2020
1 parent 75a56f1 commit 6682911
Show file tree
Hide file tree
Showing 16 changed files with 80 additions and 40 deletions.
4 changes: 2 additions & 2 deletions autogen/main/cluster.tf.tmpl
Expand Up @@ -539,9 +539,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
11 changes: 8 additions & 3 deletions autogen/main/scripts/wait-for-cluster.sh
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
4 changes: 2 additions & 2 deletions cluster.tf
Expand Up @@ -323,9 +323,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
4 changes: 2 additions & 2 deletions modules/beta-private-cluster-update-variant/cluster.tf
Expand Up @@ -497,9 +497,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
4 changes: 2 additions & 2 deletions modules/beta-private-cluster/cluster.tf
Expand Up @@ -424,9 +424,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
11 changes: 8 additions & 3 deletions modules/beta-private-cluster/scripts/wait-for-cluster.sh
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
4 changes: 2 additions & 2 deletions modules/beta-public-cluster-update-variant/cluster.tf
Expand Up @@ -478,9 +478,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
4 changes: 2 additions & 2 deletions modules/beta-public-cluster/cluster.tf
Expand Up @@ -405,9 +405,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
11 changes: 8 additions & 3 deletions modules/beta-public-cluster/scripts/wait-for-cluster.sh
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
4 changes: 2 additions & 2 deletions modules/private-cluster-update-variant/cluster.tf
Expand Up @@ -409,9 +409,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
4 changes: 2 additions & 2 deletions modules/private-cluster/cluster.tf
Expand Up @@ -336,9 +336,9 @@ module "gcloud_wait_for_cluster" {
upgrade = var.gcloud_upgrade

create_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
create_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
create_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"
destroy_cmd_entrypoint = "${path.module}/scripts/wait-for-cluster.sh"
destroy_cmd_body = "${var.project_id} ${var.name} ${var.impersonate_service_account}"
destroy_cmd_body = "${var.project_id} ${var.name} ${local.location} ${var.impersonate_service_account}"

module_depends_on = concat(
[google_container_cluster.primary.master_version],
Expand Down
11 changes: 8 additions & 3 deletions modules/private-cluster/scripts/wait-for-cluster.sh
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down
11 changes: 8 additions & 3 deletions scripts/wait-for-cluster.sh
Expand Up @@ -22,12 +22,17 @@ fi

PROJECT=$1
CLUSTER_NAME=$2
IMPERSONATE_SERVICE_ACCOUNT=$3
CLUSTER_LOCATION=$3
IMPERSONATE_SERVICE_ACCOUNT=$4

echo "Waiting for cluster $CLUSTER_NAME in project $PROJECT to reconcile..."
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
current_status=$(gcloud container clusters list --project="$PROJECT" --filter=name:"$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME AND location=$CLUSTER_LOCATION" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
fi
[[ "${current_status}" != "RUNNING" ]]
do printf ".";sleep 5; done

Expand Down

0 comments on commit 6682911

Please sign in to comment.