cni: Update CNI download URLs to use new GCS bucket (k8s-artifacts-cni)

Signed-off-by: Stephen Augustus <saugustus@vmware.com>
This commit is contained in:
Stephen Augustus 2019-07-09 12:03:31 -04:00
parent f5a008746a
commit 96f2588b61
8 changed files with 24 additions and 18 deletions

View File

@ -28,6 +28,7 @@ BASEIMAGE=k8s.gcr.io/debian-base-$(ARCH):0.4.1
CNI_VERSION=v0.7.5
TEMP_DIR:=$(shell mktemp -d)
# TODO(justaugustus): Post-0.7.5 CNI needs a "cni-plugins-linux-" prefix
CNI_TARBALL=cni-plugins-$(ARCH)-$(CNI_VERSION).tgz
# This option is for running docker manifest command
@ -58,7 +59,7 @@ push-manifest:
cni-tars/$(CNI_TARBALL):
mkdir -p cni-tars/
cd cni-tars/ && curl -sSLO --retry 5 https://storage.googleapis.com/kubernetes-release/network-plugins/${CNI_TARBALL}
cd cni-tars/ && curl -sSLO --retry 5 https://storage.googleapis.com/k8s-artifacts-cni/release/${CNI_VERSION}/${CNI_TARBALL}
clean:
rm -rf cni-tars/

View File

@ -53,13 +53,14 @@ def release_dependencies():
debian_image_dependencies()
etcd_tarballs()
# TODO(justaugustus): Post-0.7.5 CNI needs a "cni-plugins-linux-" prefix
def cni_tarballs():
for arch, sha in _CNI_TARBALL_ARCH_SHA256.items():
http_file(
name = "kubernetes_cni_%s" % arch,
downloaded_file_path = "kubernetes_cni.tgz",
sha256 = sha,
urls = mirror("https://storage.googleapis.com/kubernetes-release/network-plugins/cni-plugins-%s-v%s.tgz" % (arch, CNI_VERSION)),
urls = mirror("https://storage.googleapis.com/k8s-artifacts-cni/release/v%s/cni-plugins-%s-v%s.tgz" % (CNI_VERSION, arch, CNI_VERSION)),
)
def cri_tarballs():

View File

@ -290,10 +290,10 @@ NODE_PROBLEM_DETECTOR_TAR_HASH="${NODE_PROBLEM_DETECTOR_TAR_HASH:-}"
NODE_PROBLEM_DETECTOR_RELEASE_PATH="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-}"
NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS="${NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS:-}"
CNI_STORAGE_PATH="${CNI_STORAGE_PATH:-https://storage.googleapis.com/kubernetes-release/network-plugins}"
CNI_TAR_PREFIX="${CNI_TAR_PREFIX:-cni-plugins-amd64-}"
CNI_VERSION="${CNI_VERSION:-}"
CNI_SHA1="${CNI_SHA1:-}"
# TODO(justaugustus): Post-0.7.5 CNI needs a "cni-plugins-linux-" prefix
CNI_TAR_PREFIX="${CNI_TAR_PREFIX:-cni-plugins-amd64-}"
CNI_STORAGE_URL_BASE="${CNI_STORAGE_URL_BASE:-https://storage.googleapis.com/k8s-artifacts-cni/release}"
# Optional: Create autoscaler for cluster's nodes.
ENABLE_CLUSTER_AUTOSCALER="${KUBE_ENABLE_CLUSTER_AUTOSCALER:-false}"

View File

@ -321,10 +321,10 @@ NODE_PROBLEM_DETECTOR_TAR_HASH="${NODE_PROBLEM_DETECTOR_TAR_HASH:-}"
NODE_PROBLEM_DETECTOR_RELEASE_PATH="${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-}"
NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS="${NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS:-}"
CNI_STORAGE_PATH="${CNI_STORAGE_PATH:-https://storage.googleapis.com/kubernetes-release/network-plugins}"
CNI_TAR_PREFIX="${CNI_TAR_PREFIX:-cni-plugins-amd64-}"
CNI_VERSION="${CNI_VERSION:-}"
CNI_SHA1="${CNI_SHA1:-}"
# TODO(justaugustus): Post-0.7.5 CNI needs a "cni-plugins-linux-" prefix
CNI_TAR_PREFIX="${CNI_TAR_PREFIX:-cni-plugins-amd64-}"
CNI_STORAGE_URL_BASE="${CNI_STORAGE_URL_BASE:-https://storage.googleapis.com/k8s-artifacts-cni/release}"
# Optional: Create autoscaler for cluster's nodes.
ENABLE_CLUSTER_AUTOSCALER="${KUBE_ENABLE_CLUSTER_AUTOSCALER:-false}"

View File

@ -236,19 +236,23 @@ function install-node-problem-detector {
function install-cni-binaries {
if [[ -n "${CNI_VERSION:-}" ]]; then
local -r cni_tar="${CNI_TAR_PREFIX}${CNI_VERSION}.tgz"
local -r cni_version="${CNI_VERSION}"
local -r cni_sha1="${CNI_SHA1}"
else
local -r cni_tar="${CNI_TAR_PREFIX}${DEFAULT_CNI_VERSION}.tgz"
local -r cni_version="${DEFAULT_CNI_VERSION}"
local -r cni_sha1="${DEFAULT_CNI_SHA1}"
fi
local -r cni_tar="${CNI_TAR_PREFIX}${cni_version}.tgz"
local -r cni_url="${CNI_STORAGE_URL_BASE}/${cni_version}/${cni_tar}"
if is-preloaded "${cni_tar}" "${cni_sha1}"; then
echo "${cni_tar} is preloaded."
return
fi
echo "Downloading cni binaries"
download-or-bust "${cni_sha1}" "${CNI_STORAGE_PATH}/${cni_tar}"
download-or-bust "${cni_sha1}" "${cni_url}"
local -r cni_dir="${KUBE_HOME}/cni"
mkdir -p "${cni_dir}/bin"
tar xzf "${KUBE_HOME}/${cni_tar}" -C "${cni_dir}/bin" --overwrite

View File

@ -1142,7 +1142,7 @@ NODE_PROBLEM_DETECTOR_VERSION: $(yaml-quote ${NODE_PROBLEM_DETECTOR_VERSION:-})
NODE_PROBLEM_DETECTOR_TAR_HASH: $(yaml-quote ${NODE_PROBLEM_DETECTOR_TAR_HASH:-})
NODE_PROBLEM_DETECTOR_RELEASE_PATH: $(yaml-quote ${NODE_PROBLEM_DETECTOR_RELEASE_PATH:-})
NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS: $(yaml-quote ${NODE_PROBLEM_DETECTOR_CUSTOM_FLAGS:-})
CNI_STORAGE_PATH: $(yaml-quote ${CNI_STORAGE_PATH:-})
CNI_STORAGE_URL_BASE: $(yaml-quote ${CNI_STORAGE_URL_BASE:-})
CNI_TAR_PREFIX: $(yaml-quote ${CNI_TAR_PREFIX:-})
CNI_VERSION: $(yaml-quote ${CNI_VERSION:-})
CNI_SHA1: $(yaml-quote ${CNI_SHA1:-})

View File

@ -953,18 +953,17 @@ function Configure-CniNetworking {
# CLUSTER_IP_RANGE
# SERVICE_CLUSTER_IP_RANGE
function Configure_Dockerd_CniNetworking {
$CNI_RELEASE_VERSION = 'v0.8.2-gke.0'
$CNI_RELEASE_VERSION = 'v0.8.2'
if ((ShouldWrite-File ${env:CNI_DIR}\win-bridge.exe) -or
(ShouldWrite-File ${env:CNI_DIR}\host-local.exe)) {
$tmp_dir = 'C:\cni_tmp'
New-Item $tmp_dir -ItemType 'directory' -Force | Out-Null
$release_url = ('https://www.googleapis.com/storage/v1/b/gke-release/o/cni-plugins%2f' +
$release_url = ('https://storage.googleapis.com/k8s-artifacts-cni/release%2f' +
$CNI_RELEASE_VERSION + '%2f')
$sha_url = ($release_url +
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz.sha1?alt=media")
$tgz_url = ($release_url +
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz?alt=media")
"cni-plugins-windows-amd64-$CNI_RELEASE_VERSION.tgz")
$sha_url = ($tgz_url + ".sha1")
MustDownload-File -URLs $sha_url -OutFile $tmp_dir\cni-plugins.sha1
$sha1_val = ($(Get-Content $tmp_dir\cni-plugins.sha1) -split ' ',2)[0]
MustDownload-File `

View File

@ -31,7 +31,8 @@ const (
cniArch = "amd64"
cniDirectory = "cni/bin" // The CNI tarball places binaries under directory under "cni/bin".
cniConfDirectory = "cni/net.d"
cniURL = "https://dl.k8s.io/network-plugins/cni-plugins-" + cniArch + "-" + cniVersion + ".tgz"
// TODO(justaugustus): Post-0.7.5 CNI needs a "cni-plugins-linux-" prefix
cniURL = "https://storage.googleapis.com/k8s-artifacts-cni/release/" + cniVersion + "/" + "cni-plugins-" + cniArch + "-" + cniVersion + ".tgz"
)
const cniConfig = `{