mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Don't update gcloud in cluster/*/util.sh
This commit is contained in:
		@@ -950,3 +950,42 @@ function parse-master-env() {
 | 
				
			|||||||
  KUBELET_CERT_BASE64=$(get-env-val "${master_env}" "KUBELET_CERT")
 | 
					  KUBELET_CERT_BASE64=$(get-env-val "${master_env}" "KUBELET_CERT")
 | 
				
			||||||
  KUBELET_KEY_BASE64=$(get-env-val "${master_env}" "KUBELET_KEY")
 | 
					  KUBELET_KEY_BASE64=$(get-env-val "${master_env}" "KUBELET_KEY")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Update or verify required gcloud components are installed
 | 
				
			||||||
 | 
					# at minimum required version.
 | 
				
			||||||
 | 
					# Assumed vars
 | 
				
			||||||
 | 
					#   KUBE_PROMPT_FOR_UPDATE
 | 
				
			||||||
 | 
					function update-or-verify-gcloud() {
 | 
				
			||||||
 | 
					  local sudo_prefix=""
 | 
				
			||||||
 | 
					  if [ ! -w $(dirname `which gcloud`) ]; then
 | 
				
			||||||
 | 
					    sudo_prefix="sudo"
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  # update and install components as needed
 | 
				
			||||||
 | 
					  if [[ "${KUBE_PROMPT_FOR_UPDATE}" == "y" ]]; then
 | 
				
			||||||
 | 
					    ${sudo_prefix} gcloud ${gcloud_prompt:-} components install alpha
 | 
				
			||||||
 | 
					    ${sudo_prefix} gcloud ${gcloud_prompt:-} components install beta
 | 
				
			||||||
 | 
					    ${sudo_prefix} gcloud ${gcloud_prompt:-} components update
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    local version=$(${sudo_prefix} gcloud version --format=json)
 | 
				
			||||||
 | 
					    python -c'
 | 
				
			||||||
 | 
					import json,sys
 | 
				
			||||||
 | 
					from distutils import version
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					minVersion = version.LooseVersion("1.3.0")
 | 
				
			||||||
 | 
					required = [ "alpha", "beta", "core" ]
 | 
				
			||||||
 | 
					data = json.loads(sys.argv[1])
 | 
				
			||||||
 | 
					rel = data.get("Google Cloud SDK")
 | 
				
			||||||
 | 
					if rel != "HEAD" and version.LooseVersion(rel) < minVersion:
 | 
				
			||||||
 | 
					  print "gcloud version out of date ( < %s )" % minVersion
 | 
				
			||||||
 | 
					  exit(1)
 | 
				
			||||||
 | 
					missing = []
 | 
				
			||||||
 | 
					for c in required:
 | 
				
			||||||
 | 
					  if not data.get(c):
 | 
				
			||||||
 | 
					    missing += [c]
 | 
				
			||||||
 | 
					if missing:
 | 
				
			||||||
 | 
					  for c in missing:
 | 
				
			||||||
 | 
					    print ("missing required gcloud component \"{0}\"".format(c))
 | 
				
			||||||
 | 
					  exit(1)
 | 
				
			||||||
 | 
					    ' """${version}"""
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -80,8 +80,7 @@ NODE_TAGS="${NODE_TAG}"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ALLOCATE_NODE_CIDRS=true
 | 
					ALLOCATE_NODE_CIDRS=true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KUBE_PROMPT_FOR_UPDATE=y
 | 
					KUBE_PROMPT_FOR_UPDATE=${KUBE_PROMPT_FOR_UPDATE:-"n"}
 | 
				
			||||||
KUBE_SKIP_UPDATE=${KUBE_SKIP_UPDATE-"n"}
 | 
					 | 
				
			||||||
# How long (in seconds) to wait for cluster initialization.
 | 
					# How long (in seconds) to wait for cluster initialization.
 | 
				
			||||||
KUBE_CLUSTER_INITIALIZATION_TIMEOUT=${KUBE_CLUSTER_INITIALIZATION_TIMEOUT:-300}
 | 
					KUBE_CLUSTER_INITIALIZATION_TIMEOUT=${KUBE_CLUSTER_INITIALIZATION_TIMEOUT:-300}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,12 +98,10 @@ function verify-prereqs() {
 | 
				
			|||||||
  local cmd
 | 
					  local cmd
 | 
				
			||||||
  for cmd in gcloud gsutil; do
 | 
					  for cmd in gcloud gsutil; do
 | 
				
			||||||
    if ! which "${cmd}" >/dev/null; then
 | 
					    if ! which "${cmd}" >/dev/null; then
 | 
				
			||||||
      local resp
 | 
					      local resp="n"
 | 
				
			||||||
      if [[ "${KUBE_PROMPT_FOR_UPDATE}" == "y" ]]; then
 | 
					      if [[ "${KUBE_PROMPT_FOR_UPDATE}" == "y" ]]; then
 | 
				
			||||||
        echo "Can't find ${cmd} in PATH.  Do you wish to install the Google Cloud SDK? [Y/n]"
 | 
					        echo "Can't find ${cmd} in PATH.  Do you wish to install the Google Cloud SDK? [Y/n]"
 | 
				
			||||||
        read resp
 | 
					        read resp
 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        resp="y"
 | 
					 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
      if [[ "${resp}" != "n" && "${resp}" != "N" ]]; then
 | 
					      if [[ "${resp}" != "n" && "${resp}" != "N" ]]; then
 | 
				
			||||||
        curl https://sdk.cloud.google.com | bash
 | 
					        curl https://sdk.cloud.google.com | bash
 | 
				
			||||||
@@ -116,20 +113,7 @@ function verify-prereqs() {
 | 
				
			|||||||
      fi
 | 
					      fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  done
 | 
					  done
 | 
				
			||||||
  if [[ "${KUBE_SKIP_UPDATE}" == "y" ]]; then
 | 
					  update-or-verify-gcloud
 | 
				
			||||||
    return
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  # update and install components as needed
 | 
					 | 
				
			||||||
  if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then
 | 
					 | 
				
			||||||
    gcloud_prompt="-q"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  local sudo_prefix=""
 | 
					 | 
				
			||||||
  if [ ! -w $(dirname `which gcloud`) ]; then
 | 
					 | 
				
			||||||
    sudo_prefix="sudo"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  ${sudo_prefix} gcloud ${gcloud_prompt:-} components install alpha || true
 | 
					 | 
				
			||||||
  ${sudo_prefix} gcloud ${gcloud_prompt:-} components install beta || 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.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,8 +18,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Uses the config file specified in $KUBE_CONFIG_FILE, or defaults to config-default.sh
 | 
					# Uses the config file specified in $KUBE_CONFIG_FILE, or defaults to config-default.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
KUBE_PROMPT_FOR_UPDATE=y
 | 
					KUBE_PROMPT_FOR_UPDATE=${KUBE_PROMPT_FOR_UPDATE:-"n"}
 | 
				
			||||||
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}"
 | 
				
			||||||
source "${KUBE_ROOT}/cluster/common.sh"
 | 
					source "${KUBE_ROOT}/cluster/common.sh"
 | 
				
			||||||
@@ -78,8 +77,6 @@ function verify-prereqs() {
 | 
				
			|||||||
    if [[ "${KUBE_PROMPT_FOR_UPDATE}" == "y" ]]; then
 | 
					    if [[ "${KUBE_PROMPT_FOR_UPDATE}" == "y" ]]; then
 | 
				
			||||||
      echo "Can't find gcloud in PATH.  Do you wish to install the Google Cloud SDK? [Y/n]"
 | 
					      echo "Can't find gcloud in PATH.  Do you wish to install the Google Cloud SDK? [Y/n]"
 | 
				
			||||||
      read resp
 | 
					      read resp
 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      resp="y"
 | 
					 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    if [[ "${resp}" != "n" && "${resp}" != "N" ]]; then
 | 
					    if [[ "${resp}" != "n" && "${resp}" != "N" ]]; then
 | 
				
			||||||
      curl https://sdk.cloud.google.com | bash
 | 
					      curl https://sdk.cloud.google.com | bash
 | 
				
			||||||
@@ -90,21 +87,7 @@ function verify-prereqs() {
 | 
				
			|||||||
      exit 1
 | 
					      exit 1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  if [[ "${KUBE_SKIP_UPDATE}" == "y" ]]; then
 | 
					  update-or-verify-gcloud
 | 
				
			||||||
    return
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  # update and install components as needed
 | 
					 | 
				
			||||||
  if [[ "${KUBE_PROMPT_FOR_UPDATE}" != "y" ]]; then
 | 
					 | 
				
			||||||
    gcloud_prompt="-q"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  local sudo_prefix=""
 | 
					 | 
				
			||||||
  if [ ! -w $(dirname `which gcloud`) ]; then
 | 
					 | 
				
			||||||
    sudo_prefix="sudo"
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  ${sudo_prefix} gcloud ${gcloud_prompt:-} components install alpha || true
 | 
					 | 
				
			||||||
  ${sudo_prefix} gcloud ${gcloud_prompt:-} components install beta || true
 | 
					 | 
				
			||||||
  ${sudo_prefix} gcloud ${gcloud_prompt:-} components install kubectl|| true
 | 
					 | 
				
			||||||
  ${sudo_prefix} gcloud ${gcloud_prompt:-} components update || true
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Validate a kubernetes cluster
 | 
					# Validate a kubernetes cluster
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user