Commit c9988db0 authored by Zach Loafman's avatar Zach Loafman

Merge pull request #7146 from brendandburns/get-k8s

Extend the get-cluster.sh script to use sudo if necessary.
parents 8b04e7f7 42121d18
...@@ -25,6 +25,7 @@ source "${KUBE_ROOT}/cluster/common.sh" ...@@ -25,6 +25,7 @@ source "${KUBE_ROOT}/cluster/common.sh"
NODE_INSTANCE_PREFIX="${INSTANCE_PREFIX}-minion" NODE_INSTANCE_PREFIX="${INSTANCE_PREFIX}-minion"
KUBE_PROMPT_FOR_UPDATE=y KUBE_PROMPT_FOR_UPDATE=y
KUBE_SKIP_UPDATE=${KUBE_SKIP_UPDATE-"n"}
# Verify prereqs # Verify prereqs
function verify-prereqs { function verify-prereqs {
...@@ -48,12 +49,19 @@ function verify-prereqs { ...@@ -48,12 +49,19 @@ function verify-prereqs {
fi fi
fi fi
done done
if [[ "${KUBE_SKIP_UPDATE} == "y" ]]; then
return
fi
# update and install components as needed # update and install components as needed
if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then
gcloud_prompt="-q" gcloud_prompt="-q"
fi fi
gcloud ${gcloud_prompt:-} components update preview || true if [ ! -w $(dirname `which gcloud`) ]; then
gcloud ${gcloud_prompt:-} components update || true sudo_prefix="sudo"
fi
${sudo_prefix} gcloud ${gcloud_prompt:-} components update preview || true
${sudo_prefix} gcloud ${gcloud_prompt:-} components update alpha || true
${sudo_prefix} gcloud ${gcloud_prompt:-} components update || true
} }
# Create a temp dir that'll be deleted at the end of this bash session. # Create a temp dir that'll be deleted at the end of this bash session.
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
# config-default.sh. # config-default.sh.
KUBE_PROMPT_FOR_UPDATE=y KUBE_PROMPT_FOR_UPDATE=y
KUBE_SKIP_UPDATE=${KUBE_SKIP_UPDATE-"n"}
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/gke/${KUBE_CONFIG_FILE:-config-default.sh}" source "${KUBE_ROOT}/cluster/gke/${KUBE_CONFIG_FILE:-config-default.sh}"
...@@ -86,13 +87,19 @@ function verify-prereqs() { ...@@ -86,13 +87,19 @@ function verify-prereqs() {
exit 1 exit 1
fi fi
fi fi
if [[ "${KUBE_SKIP_UPDATE} == "y" ]]; then
return
fi
# update and install components as needed # update and install components as needed
if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then
gcloud_prompt="-q" gcloud_prompt="-q"
fi fi
gcloud ${gcloud_prompt:-} components update preview || true if [ ! -w $(dirname `which gcloud`) ]; then
gcloud ${gcloud_prompt:-} components update alpha || true sudo_prefix="sudo"
gcloud ${gcloud_prompt:-} components update || true fi
${sudo_prefix} gcloud ${gcloud_prompt:-} components update preview || true
${sudo_prefix} gcloud ${gcloud_prompt:-} components update alpha|| true
${sudo_prefix} gcloud ${gcloud_prompt:-} components update || true
} }
# Instantiate a kubernetes cluster # Instantiate a kubernetes cluster
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment