From 9899af6ca22730d637d660bd0f76657921779a18 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Wed, 11 May 2016 16:19:18 +0300 Subject: [PATCH] Check existence of kubernetes dir for get-kube.sh There are a lot of references to https://get.k8s.io/ over the internet. Most of such references do not describe KUBERNETES_SKIP_DOWNLOAD env variable and newbies can get into a situation described below: - execute `wget -q -O - https://get.k8s.io | bash` - receive a failure due too missed packages or some configs - fix the issue - try again `wget -q -O - https://get.k8s.io | bash` In this case, get-kube.sh will not check that kubernetes directory already exist and repeat download again. Lets make get-kube.sh more user-friednly and check existence if kubernetes dir --- cluster/get-kube.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cluster/get-kube.sh b/cluster/get-kube.sh index f74b752c1d..fad4c1d47b 100755 --- a/cluster/get-kube.sh +++ b/cluster/get-kube.sh @@ -65,6 +65,18 @@ if [[ "${KUBERNETES_SKIP_DOWNLOAD-}" ]]; then exit 0 fi +if [[ -d "./kubernetes" ]]; then + if [[ -n "${KUBERNETES_SKIP_CONFIRM-}" ]]; then + echo "'kubernetes' directory already exist. Should we skip download step and start to create cluster based on it? [Y]/n" + read confirm + if [[ "$confirm" == "y" ]]; then + echo "Skipping download step." + create_cluster + exit 0 + fi + fi +fi + function get_latest_version_number { local -r latest_url="https://storage.googleapis.com/kubernetes-release/release/stable.txt" if [[ $(which wget) ]]; then