Skip to content

Commit

Permalink
Merge pull request #142 from reactiveops/dosullivan/prepare-gcloud-au…
Browse files Browse the repository at this point in the history
…th-change

only require GCP_ZONE and CLUSTER_NAME if configuring cluster access
  • Loading branch information
dosullivan authored Apr 18, 2018
2 parents 50c8821 + b28c97c commit a88c1b3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin/prepare-gcloud
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/bin/bash -e
echo "Preparing the gcloud command line tools."

if [[ -z ${GCP_PROJECT+x} ]] || [[ -z ${GCP_ZONE+x} ]] || [[ -z ${GCLOUD_KEY+x} ]] || [[ -z ${CLUSTER_NAME+x} ]]; then
if [[ -z ${GCP_PROJECT+x} ]] || [[ -z ${GCLOUD_KEY+x} ]] ; then
echo -n "Missing required variable(s):"
[[ -n ${GCP_PROJECT+x} ]] || echo -n " GCP_PROJECT"
[[ -n ${GCP_ZONE+x} ]] || echo -n " GCP_ZONE"
[[ -n ${GCLOUD_KEY+x} ]] || echo -n " GCLOUD_KEY"
[[ -n ${CLUSTER_NAME+x} ]] || echo -n " CLUSTER_NAME"
echo ""
exit 1
fi
Expand All @@ -27,5 +25,10 @@ gcloud config set project "${GCP_PROJECT}"
# Authorize the docker client to work with GCR
gcloud docker --authorize-only

# Setup cluster credentials
gcloud container clusters get-credentials "${CLUSTER_NAME}" --zone "${GCP_ZONE}" --project "${GCP_PROJECT}"
if [[ ${GCP_ZONE+x} ]] || [[ ${CLUSTER_NAME+x} ]] ; then
echo "Configuring cluster credentials."
# Setup cluster credentials
gcloud container clusters get-credentials "${CLUSTER_NAME}" --zone "${GCP_ZONE}" --project "${GCP_PROJECT}"
echo ""
exit 0
fi

0 comments on commit a88c1b3

Please sign in to comment.