Merge pull request #7146 from brendandburns/get-k8s

Extend the get-cluster.sh script to use sudo if necessary.
This commit is contained in:
Zach Loafman
2015-04-22 09:58:07 -07:00
2 changed files with 20 additions and 5 deletions

View File

@@ -25,6 +25,7 @@ source "${KUBE_ROOT}/cluster/common.sh"
NODE_INSTANCE_PREFIX="${INSTANCE_PREFIX}-minion"
KUBE_PROMPT_FOR_UPDATE=y
KUBE_SKIP_UPDATE=${KUBE_SKIP_UPDATE-"n"}
# Verify prereqs
function verify-prereqs {
@@ -48,12 +49,19 @@ function verify-prereqs {
fi
fi
done
if [[ "${KUBE_SKIP_UPDATE} == "y" ]]; then
return
fi
# update and install components as needed
if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then
gcloud_prompt="-q"
fi
gcloud ${gcloud_prompt:-} components update preview || true
gcloud ${gcloud_prompt:-} components update || true
if [ ! -w $(dirname `which gcloud`) ]; then
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.