mirror of https://github.com/k3s-io/k3s
Merge pull request #7146 from brendandburns/get-k8s
Extend the get-cluster.sh script to use sudo if necessary.pull/6/head
commit
c9988db0ee
|
@ -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 {
|
||||||
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 @@
|
||||||
# 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() {
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue