mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-20 10:20:51 +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:
parent
fd5d61060a
commit
cebb1b3393
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user