From 63e5eb5ad981455f1ab8e79566a55c168d938ec0 Mon Sep 17 00:00:00 2001 From: m77so Date: Thu, 16 Jan 2025 18:03:53 +0900 Subject: [PATCH 1/2] Support CLOUDSDK_GET_CREDENTIALS_OPTS in Helm based on https://github.com/GoogleCloudPlatform/cloud-builders/blob/88de3665c77e9f119e5f4bb6caa40ac0bfd088be/kubectl/kubectl.bash --- helm/helm.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/helm/helm.bash b/helm/helm.bash index db414b153..fa540892d 100644 --- a/helm/helm.bash +++ b/helm/helm.bash @@ -7,13 +7,15 @@ if [[ $(kubectl config current-context 2> /dev/null) == "" && "$SKIP_CLUSTER_CON region=${CLOUDSDK_COMPUTE_REGION:-$(gcloud config get-value compute/region 2> /dev/null)} zone=${CLOUDSDK_COMPUTE_ZONE:-$(gcloud config get-value compute/zone 2> /dev/null)} project=${GCLOUD_PROJECT:-$(gcloud config get-value core/project 2> /dev/null)} - + get_cred_opts=${CLOUDSDK_GET_CREDENTIALS_OPTS:+${CLOUDSDK_GET_CREDENTIALS_OPTS} } function var_usage() { cat < (regional clusters) CLOUDSDK_COMPUTE_ZONE= (zonal clusters) CLOUDSDK_CONTAINER_CLUSTER= + + Optionally, you can specify additional parameters for the 'gcloud container clusters get-credentials' command via CLOUDSDK_GET_CREDENTIALS_OPTS, such using values as: --internal-ip, --dns-endpoint EOF exit 1 } @@ -22,11 +24,11 @@ EOF [ ! "$zone" -o "$region" ] && var_usage if [ -n "$region" ]; then - echo "Running: gcloud container clusters get-credentials --project=\"$project\" --region=\"$region\" \"$cluster\"" - gcloud container clusters get-credentials --project="$project" --region="$region" "$cluster" + echo "Running: gcloud container clusters get-credentials --project=\"$project\" --region=\"$region\" ${get_cred_opts}\"$cluster\"" + gcloud container clusters get-credentials --project="$project" --region="$region" ${get_cred_opts}"$cluster" else - echo "Running: gcloud container clusters get-credentials --project=\"$project\" --zone=\"$zone\" \"$cluster\"" - gcloud container clusters get-credentials --project="$project" --zone="$zone" "$cluster" + echo "Running: gcloud container clusters get-credentials --project=\"$project\" --zone=\"$zone\" ${get_cred_opts}\"$cluster\"" + gcloud container clusters get-credentials --project="$project" --zone="$zone" ${get_cred_opts}"$cluster" fi fi From 7a1732492df36926bcf1c486c68d3197cb391307 Mon Sep 17 00:00:00 2001 From: m77so Date: Wed, 22 Jan 2025 17:44:59 +0900 Subject: [PATCH 2/2] Change 'such using values as' to 'such as' --- helm/helm.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/helm.bash b/helm/helm.bash index fa540892d..5af8429a1 100644 --- a/helm/helm.bash +++ b/helm/helm.bash @@ -15,7 +15,7 @@ No cluster is set. To set the cluster (and the region/zone where it is found), s CLOUDSDK_COMPUTE_ZONE= (zonal clusters) CLOUDSDK_CONTAINER_CLUSTER= - Optionally, you can specify additional parameters for the 'gcloud container clusters get-credentials' command via CLOUDSDK_GET_CREDENTIALS_OPTS, such using values as: --internal-ip, --dns-endpoint + Optionally, you can specify additional parameters for the 'gcloud container clusters get-credentials' command via CLOUDSDK_GET_CREDENTIALS_OPTS, such as: --internal-ip, --dns-endpoint EOF exit 1 }