Skip to content

Commit

Permalink
fix: fallback to name if location is not set (#736)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb committed Nov 5, 2020
1 parent 6682911 commit 63d7f5e
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 8 deletions.
7 changes: 6 additions & 1 deletion autogen/main/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
7 changes: 6 additions & 1 deletion modules/beta-private-cluster/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
7 changes: 6 additions & 1 deletion modules/beta-public-cluster/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
7 changes: 6 additions & 1 deletion modules/private-cluster/scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down
7 changes: 6 additions & 1 deletion scripts/wait-for-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ IMPERSONATE_SERVICE_ACCOUNT=$4
echo "Waiting for cluster $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME to reconcile..."

while
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 cluster location is set, use it in filter
if [ -z "${CLUSTER_LOCATION}" ]; then
current_status=$(gcloud container clusters list --project="$PROJECT" --filter="name=$CLUSTER_NAME" --format="value(status)" --impersonate-service-account="$IMPERSONATE_SERVICE_ACCOUNT")
else
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")
fi
if [ -z "${current_status}" ]; then
echo "Unable to get status for $PROJECT/$CLUSTER_LOCATION/$CLUSTER_NAME"
exit 1
Expand Down

0 comments on commit 63d7f5e

Please sign in to comment.