diff --git a/cluster/get-kube-binaries.sh b/cluster/get-kube-binaries.sh index 800e9540b19..dc9d29a6537 100755 --- a/cluster/get-kube-binaries.sh +++ b/cluster/get-kube-binaries.sh @@ -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 diff --git a/cluster/get-kube.sh b/cluster/get-kube.sh index 608e4940815..f6a3419885e 100755 --- a/cluster/get-kube.sh +++ b/cluster/get-kube.sh @@ -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