Skip to content

Commit

Permalink
use dl.k8s.io where possible
Browse files Browse the repository at this point in the history
The only time a kubernetes GCS bucket name should be showing up in a
hardcoded URI is if gsutil is being used (e.g. gsutil cp gs://foo/bar .)

Otherwise, for tools like curl or wget, dl.k8s.io is much nicer for us
as a project, since we can transparently change where that redirects to
without having to change code everywhere

These changes will mean very few changes will be necessary to
accommodate a gs://kubernetes-release -> gs://k8s-release migration
equivalent of the CI migration we're going through right now

These changes also address the gs://kubernetes-release-dev references
currently used by this repo (ref:
kubernetes/k8s.io#2318)
  • Loading branch information
spiffxp committed Jul 19, 2021
1 parent 089304b commit cf2335c
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 18 deletions.
6 changes: 1 addition & 5 deletions cluster/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,7 @@ function load-or-gen-kube-basicauth() {
function set_binary_version() {
if [[ "${1}" =~ "/" ]]; then
IFS='/' read -r -a path <<< "${1}"
if [[ "${path[0]}" == "release" ]]; then
KUBE_VERSION=$(gsutil cat "gs://kubernetes-release/${1}.txt")
else
KUBE_VERSION=$(gsutil cat "gs://kubernetes-release-dev/${1}.txt")
fi
KUBE_VERSION=$(curl -Ls "https://dl.k8s.io/${1}.txt")
else
KUBE_VERSION=${1}
fi
Expand Down
2 changes: 1 addition & 1 deletion cluster/gce/gci/configure-helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3018,7 +3018,7 @@ You can find documentation for Kubernetes at:
The source for this release can be found at:
/home/kubernetes/kubernetes-src.tar.gz
Or you can download it at:
https://storage.googleapis.com/kubernetes-release/release/${version}/kubernetes-src.tar.gz
https://dl.k8s.io/release/${version}/kubernetes-src.tar.gz
It is based on the Kubernetes source at:
https://github.com/kubernetes/kubernetes/tree/${gitref}
Expand Down
4 changes: 2 additions & 2 deletions cluster/gce/gci/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function install-gci-mounter-tools {
mkdir -p "${CONTAINERIZED_MOUNTER_HOME}"
chmod a+x "${CONTAINERIZED_MOUNTER_HOME}"
mkdir -p "${CONTAINERIZED_MOUNTER_HOME}/rootfs"
download-or-bust "${mounter_tar_sha}" "https://storage.googleapis.com/kubernetes-release/gci-mounter/mounter.tar"
download-or-bust "${mounter_tar_sha}" "https://dl.k8s.io/gci-mounter/mounter.tar"
cp "${KUBE_HOME}/kubernetes/server/bin/mounter" "${CONTAINERIZED_MOUNTER_HOME}/mounter"
chmod a+x "${CONTAINERIZED_MOUNTER_HOME}/mounter"
mv "${KUBE_HOME}/mounter.tar" /tmp/mounter.tar
Expand All @@ -271,7 +271,7 @@ function install-node-problem-detector {
fi

echo "Downloading ${npd_tar}."
local -r npd_release_path="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-https://storage.googleapis.com/kubernetes-release}"
local -r npd_release_path="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-https://dl.k8s.io}"
download-or-bust "${npd_hash}" "${npd_release_path}/node-problem-detector/${npd_tar}"
local -r npd_dir="${KUBE_HOME}/node-problem-detector"
mkdir -p "${npd_dir}"
Expand Down
6 changes: 3 additions & 3 deletions cluster/gce/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ function usage() {
local release_latest
local ci_latest

release_stable=$(gsutil cat gs://kubernetes-release/release/stable.txt)
release_latest=$(gsutil cat gs://kubernetes-release/release/latest.txt)
ci_latest=$(gsutil cat gs://kubernetes-release-dev/ci/latest.txt)
release_stable=$(curl -Ls https://dl.k8s.io/release/stable.txt)
release_latest=$(curl -Ls https://dl.k8s.io/release/latest.txt)
ci_latest=$(curl -Ls https://dl.k8s.io/ci/latest.txt)

echo "Right now, versions are as follows:"
echo " release/stable: ${0} ${release_stable}"
Expand Down
6 changes: 3 additions & 3 deletions cluster/gce/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -526,13 +526,13 @@ function tars_from_version() {
find-release-tars
upload-tars
elif [[ ${KUBE_VERSION} =~ ${KUBE_RELEASE_VERSION_REGEX} ]]; then
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
SERVER_BINARY_TAR_URL="https://dl.k8s.io/release/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
# TODO: Clean this up.
KUBE_MANIFESTS_TAR_URL="${SERVER_BINARY_TAR_URL/server-linux-amd64/manifests}"
KUBE_MANIFESTS_TAR_HASH=$(curl "${KUBE_MANIFESTS_TAR_URL}" --silent --show-error | ${sha512sum})
KUBE_MANIFESTS_TAR_HASH=${KUBE_MANIFESTS_TAR_HASH%%[[:blank:]]*}
elif [[ ${KUBE_VERSION} =~ ${KUBE_CI_VERSION_REGEX} ]]; then
SERVER_BINARY_TAR_URL="https://storage.googleapis.com/kubernetes-release-dev/ci/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
SERVER_BINARY_TAR_URL="https://dl.k8s.io-dev/ci/${KUBE_VERSION}/kubernetes-server-linux-amd64.tar.gz"
# TODO: Clean this up.
KUBE_MANIFESTS_TAR_URL="${SERVER_BINARY_TAR_URL/server-linux-amd64/manifests}"
KUBE_MANIFESTS_TAR_HASH=$(curl "${KUBE_MANIFESTS_TAR_URL}" --silent --show-error | ${sha512sum})
Expand Down Expand Up @@ -1699,7 +1699,7 @@ function setup-easyrsa {
# Note: This was heavily cribbed from make-ca-cert.sh
(set -x
cd "${KUBE_TEMP}"
curl -L -O --connect-timeout 20 --retry 6 --retry-delay 2 https://storage.googleapis.com/kubernetes-release/easy-rsa/easy-rsa.tar.gz
curl -L -O --connect-timeout 20 --retry 6 --retry-delay 2 https://dl.k8s.io/easy-rsa/easy-rsa.tar.gz
tar xzf easy-rsa.tar.gz
mkdir easy-rsa-master/kubelet
cp -r easy-rsa-master/easyrsa3/* easy-rsa-master/kubelet
Expand Down
2 changes: 1 addition & 1 deletion cluster/get-kube-binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#
# Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt.
# Set KUBERNETES_RELEASE_URL to choose where to download binaries from.
# (Defaults to https://storage.googleapis.com/kubernetes-release/release).
# (Defaults to https://dl.k8s.io).
# Set KUBERNETES_DOWNLOAD_TESTS to additionally download and extract the test
# binaries tarball.

Expand Down
2 changes: 1 addition & 1 deletion cluster/get-kube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# stable release, (e.g. 'v1.3.7').
# See https://github.com/kubernetes/kubernetes/releases for release options.
# Set KUBERNETES_RELEASE_URL to choose where to download binaries from.
# (Defaults to https://storage.googleapis.com/kubernetes-release/release).
# (Defaults to https://dl.k8s.io/release).
#
# Set KUBERNETES_SERVER_ARCH to choose the server (Kubernetes cluster)
# architecture to download:
Expand Down
4 changes: 2 additions & 2 deletions defs/repo_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pkg_tar(
"""

def _archive_url(folder, version, archive):
return paths.join("https://storage.googleapis.com", folder, version, archive)
return paths.join("https://dl.k8s.io", folder, version, archive)

def _fetch_kube_release(ctx):
build_file_contents = BUILD_PRELUDE
Expand All @@ -33,7 +33,7 @@ def _fetch_kube_release(ctx):
fetch_kube_release = repository_rule(
implementation = _fetch_kube_release,
attrs = {
"folder": attr.string(default = "kubernetes-release/release"),
"folder": attr.string(default = "release"),
"version": attr.string(mandatory = True),
"archives": attr.string_dict(mandatory = True),
},
Expand Down

0 comments on commit cf2335c

Please sign in to comment.