mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-10-30 17:58:14 +00:00 
			
		
		
		
	Use gsutil to download kube binaries and release
Default to using gsutil to download kube artifacts to avoid network interruptions. Signed-off-by: Eddie Zaneski <eddiezane@gmail.com>
This commit is contained in:
		| @@ -156,7 +156,10 @@ function download_tarball() { | ||||
|   fi | ||||
|   url="${DOWNLOAD_URL_PREFIX}/${file}" | ||||
|   mkdir -p "${download_path}" | ||||
|   if [[ $(which curl) ]]; then | ||||
|  | ||||
|   if [[ $(which gsutil) ]] && [[ "$url" =~ ^https://storage.googleapis.com/.* ]]; then | ||||
|     gsutil cp "${url//'https://storage.googleapis.com/'/'gs://'}" "${download_path}/${file}" | ||||
|   elif [[ $(which curl) ]]; then | ||||
|     # if the url belongs to GCS API we should use oauth2_token in the headers | ||||
|     curl_headers="" | ||||
|     if { [[ "${KUBERNETES_PROVIDER:-gce}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]] ; } && | ||||
| @@ -167,7 +170,7 @@ function download_tarball() { | ||||
|   elif [[ $(which wget) ]]; then | ||||
|     wget "${url}" -O "${download_path}/${file}" | ||||
|   else | ||||
|     echo "Couldn't find curl or wget.  Bailing out." >&2 | ||||
|     echo "Couldn't find gsutil, curl, or wget.  Bailing out." >&2 | ||||
|     exit 4 | ||||
|   fi | ||||
|   echo | ||||
|   | ||||
| @@ -240,7 +240,9 @@ if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]]; then | ||||
| fi | ||||
|  | ||||
| if "${need_download}"; then | ||||
|   if [[ $(which curl) ]]; then | ||||
|   if [[ $(which gsutil) ]] && [[ "$kubernetes_tar_url" =~ ^https://storage.googleapis.com/.* ]]; then | ||||
|     gsutil cp "${kubernetes_tar_url//'https://storage.googleapis.com/'/'gs://'}" "${file}" | ||||
|   elif [[ $(which curl) ]]; then | ||||
|     # if the url belongs to GCS API we should use oauth2_token in the headers | ||||
|     curl_headers="" | ||||
|     if { [[ "${KUBERNETES_PROVIDER:-gce}" == "gce" ]] || [[ "${KUBERNETES_PROVIDER}" == "gke" ]] ; } && | ||||
| @@ -251,7 +253,7 @@ if "${need_download}"; then | ||||
|   elif [[ $(which wget) ]]; then | ||||
|     wget "${kubernetes_tar_url}" | ||||
|   else | ||||
|     echo "Couldn't find curl or wget.  Bailing out." | ||||
|     echo "Couldn't find gsutil, curl, or wget.  Bailing out." | ||||
|     exit 1 | ||||
|   fi | ||||
| fi | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Eddie Zaneski
					Eddie Zaneski