Skip to content

Commit

Permalink
Warn users if bucket's region and cluster's region do not match (#329)
Browse files Browse the repository at this point in the history
* bucket region warning in create confirmation.

* adjust the height for new warning.
  • Loading branch information
willgraf authored Apr 13, 2020
1 parent 4cd562b commit 5fe0f52
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/menu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -555,16 +555,27 @@ function confirm_cluster_launch() {
dialog --backtitle "$BRAND" --title "GKE Login Failed" --clear --msgbox \
"${error_text[*]}" 9 65
else
local h=18
local w=60
local bucket_region=$(gsutil ls -L -b "gs://${CLOUDSDK_BUCKET}" | grep "Location constraint" | awk '{print tolower($NF)}')
if [ "$CLOUDSDK_COMPUTE_REGION" = "$bucket_region" ]; then
local bucket_warning=("")
else
local bucket_warning=("\n\nThe selected region and the bucket's region do not match."
"This may cause unintended network interzone egress charges.")
h=$((h+4))
fi
local notice_text=("\nYou are about to launch a cluster using the following:"
"\n\n Cloud Account - ${current_account}"
"\n Project - ${CLOUDSDK_CORE_PROJECT}"
"\n Cluster Name - ${CLOUDSDK_CONTAINER_CLUSTER}"
"\n Bucket Name - ${CLOUDSDK_BUCKET}"
"${bucket_warning[*]}"
"\n\nPlease note that this process will take several minutes."
"If the cluster does not create successfully, it may be necessary to delete resources from the cloud console."
"\n\nWould you like to continue?")

dialog --backtitle "${BRAND}" --title "Please Confirm" --yesno "${notice_text[*]}" 18 60
dialog --backtitle "${BRAND}" --title "Please Confirm" --yesno "${notice_text[*]}" $h $w
response=$?
case $response in
0) return 0;;
Expand Down

0 comments on commit 5fe0f52

Please sign in to comment.