From 706cde51c512d8d07e35fc815af4439108a587f9 Mon Sep 17 00:00:00 2001 From: Jingyi Hu Date: Thu, 24 Oct 2019 20:50:48 -0700 Subject: [PATCH 1/2] Update default etcd server to 3.4.3 --- build/dependencies.yaml | 2 +- build/workspace.bzl | 8 ++++---- cluster/gce/config-test.sh | 2 +- cluster/gce/manifests/etcd-empty-dir-cleanup.yaml | 2 +- cluster/gce/manifests/etcd.manifest | 4 ++-- cluster/gce/upgrade-aliases.sh | 4 ++-- cluster/images/etcd-empty-dir-cleanup/Makefile | 4 ++-- cluster/images/etcd/Makefile | 15 ++++++++++----- cluster/images/etcd/README.md | 2 +- cluster/images/etcd/migrate-if-needed.sh | 6 ++++-- cmd/kubeadm/app/constants/constants.go | 8 ++++---- cmd/kubeadm/app/images/images_test.go | 4 ++-- hack/lib/etcd.sh | 2 +- .../sample-apiserver/artifacts/example/rc.yaml | 2 +- test/e2e/framework/nodes_util.go | 2 +- test/utils/image/manifest.go | 2 +- 16 files changed, 38 insertions(+), 31 deletions(-) diff --git a/build/dependencies.yaml b/build/dependencies.yaml index 8e6049e94eb..f319475649a 100644 --- a/build/dependencies.yaml +++ b/build/dependencies.yaml @@ -1,6 +1,6 @@ dependencies: - name: "etcd" - version: 3.3.17 + version: 3.4.3 refPaths: - path: cluster/gce/manifests/etcd.manifest match: etcd_docker_tag|etcd_version diff --git a/build/workspace.bzl b/build/workspace.bzl index 811d3c98c87..7dc5fe4db5f 100644 --- a/build/workspace.bzl +++ b/build/workspace.bzl @@ -38,11 +38,11 @@ _CRI_TARBALL_ARCH_SHA256 = { "windows-amd64": "7d092dcb3b1af2edf75477d5d049a70e8c0d1ac8242b1dff2de7e6aa084e3615", } -ETCD_VERSION = "3.3.17" +ETCD_VERSION = "3.4.3" _ETCD_TARBALL_ARCH_SHA256 = { - "amd64": "8c1168a24d17a2d6772f8148ea35d4f3398c51f1e23db90c849d506adb387060", - "arm64": "0ea20dfbf3085f584f788287fd398979d0f1271549be6497d81ec635b9b4c121", - "ppc64le": "49cef090eb67f0d24ebd1733303ed2088c291ad47c60f57746da9f689aa1de7a", + "amd64": "6c642b723a86941b99753dff6c00b26d3b033209b15ee33325dc8e7f4cd68f07", + "arm64": "01bd849ad99693600bd59db8d0e66ac64aac1e3801900665c31bd393972e3554", + "ppc64le": "3f20888d6efb7f2665ebe278860eec6e8fc9555624e56c3d93f5a6b6dd90a21a", } # Dependencies needed for a Kubernetes "release", e.g. building docker images, diff --git a/cluster/gce/config-test.sh b/cluster/gce/config-test.sh index 0c19d4c2730..e0e18e7a245 100755 --- a/cluster/gce/config-test.sh +++ b/cluster/gce/config-test.sh @@ -199,7 +199,7 @@ HEAPSTER_MACHINE_TYPE="${HEAPSTER_MACHINE_TYPE:-}" NUM_ADDITIONAL_NODES="${NUM_ADDITIONAL_NODES:-}" ADDITIONAL_MACHINE_TYPE="${ADDITIONAL_MACHINE_TYPE:-}" -# Set etcd image (e.g. k8s.gcr.io/etcd) and version (e.g. 3.3.15-0) if you need +# Set etcd image (e.g. k8s.gcr.io/etcd) and version (e.g. 3.4.3-0) if you need # non-default version. ETCD_IMAGE="${TEST_ETCD_IMAGE:-}" ETCD_DOCKER_REPOSITORY="${TEST_ETCD_DOCKER_REPOSITORY:-}" diff --git a/cluster/gce/manifests/etcd-empty-dir-cleanup.yaml b/cluster/gce/manifests/etcd-empty-dir-cleanup.yaml index bb454c88086..2c38e8de565 100644 --- a/cluster/gce/manifests/etcd-empty-dir-cleanup.yaml +++ b/cluster/gce/manifests/etcd-empty-dir-cleanup.yaml @@ -13,4 +13,4 @@ spec: dnsPolicy: Default containers: - name: etcd-empty-dir-cleanup - image: k8s.gcr.io/etcd-empty-dir-cleanup:3.3.17.0 + image: k8s.gcr.io/etcd-empty-dir-cleanup:3.4.3.0 diff --git a/cluster/gce/manifests/etcd.manifest b/cluster/gce/manifests/etcd.manifest index 1019e445b21..fb816ffa9ed 100644 --- a/cluster/gce/manifests/etcd.manifest +++ b/cluster/gce/manifests/etcd.manifest @@ -14,7 +14,7 @@ "containers":[ { "name": "etcd-container", - "image": "{{ pillar.get('etcd_docker_repository', 'k8s.gcr.io/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.3.17-0') }}", + "image": "{{ pillar.get('etcd_docker_repository', 'k8s.gcr.io/etcd') }}:{{ pillar.get('etcd_docker_tag', '3.4.3-0') }}", "resources": { "requests": { "cpu": {{ cpulimit }} @@ -30,7 +30,7 @@ "value": "{{ pillar.get('storage_backend', 'etcd3') }}" }, { "name": "TARGET_VERSION", - "value": "{{ pillar.get('etcd_version', '3.3.17') }}" + "value": "{{ pillar.get('etcd_version', '3.4.3') }}" }, { "name": "DATA_DIRECTORY", "value": "/var/etcd/data{{ suffix }}" diff --git a/cluster/gce/upgrade-aliases.sh b/cluster/gce/upgrade-aliases.sh index 131769c23af..7bd664d132b 100755 --- a/cluster/gce/upgrade-aliases.sh +++ b/cluster/gce/upgrade-aliases.sh @@ -170,8 +170,8 @@ export KUBE_GCE_ENABLE_IP_ALIASES=true export SECONDARY_RANGE_NAME="pods-default" export STORAGE_BACKEND="etcd3" export STORAGE_MEDIA_TYPE="application/vnd.kubernetes.protobuf" -export ETCD_IMAGE=3.3.17-0 -export ETCD_VERSION=3.3.17 +export ETCD_IMAGE=3.4.3-0 +export ETCD_VERSION=3.4.3 # Upgrade master with updated kube envs "${KUBE_ROOT}/cluster/gce/upgrade.sh" -M -l diff --git a/cluster/images/etcd-empty-dir-cleanup/Makefile b/cluster/images/etcd-empty-dir-cleanup/Makefile index e2319772089..8787e34470d 100644 --- a/cluster/images/etcd-empty-dir-cleanup/Makefile +++ b/cluster/images/etcd-empty-dir-cleanup/Makefile @@ -14,13 +14,13 @@ .PHONY: build push -ETCD_VERSION = 3.3.17 +ETCD_VERSION = 3.4.3 # Image should be pulled from k8s.gcr.io, which will auto-detect # region (us, eu, asia, ...) and pull from the closest. REGISTRY = k8s.gcr.io # Images should be pushed to staging-k8s.gcr.io. PUSH_REGISTRY = staging-k8s.gcr.io -TAG = 3.3.17.0 +TAG = 3.4.3.0 clean: rm -rf etcdctl etcd-v$(ETCD_VERSION)-linux-amd64 etcd-v$(ETCD_VERSION)-linux-amd64.tar.gz diff --git a/cluster/images/etcd/Makefile b/cluster/images/etcd/Makefile index 680b02c5149..9491af73299 100644 --- a/cluster/images/etcd/Makefile +++ b/cluster/images/etcd/Makefile @@ -15,7 +15,7 @@ # Build the etcd image # # Usage: -# [BUNDLED_ETCD_VERSIONS=3.0.17 3.1.12 3.2.24 3.3.17] [REGISTRY=k8s.gcr.io] [ARCH=amd64] [BASEIMAGE=busybox] make (build|push) +# [BUNDLED_ETCD_VERSIONS=3.0.17 3.1.12 3.2.24 3.3.17 3.4.3] [REGISTRY=k8s.gcr.io] [ARCH=amd64] [BASEIMAGE=busybox] make (build|push) # # The image contains different etcd versions to simplify # upgrades. Thus be careful when removing any versions from here. @@ -26,10 +26,10 @@ # Except from etcd-$(version) and etcdctl-$(version) binaries, we also # need etcd and etcdctl binaries for backward compatibility reasons. # That binary will be set to the last version from $(BUNDLED_ETCD_VERSIONS). -BUNDLED_ETCD_VERSIONS?=3.0.17 3.1.12 3.2.24 3.3.17 +BUNDLED_ETCD_VERSIONS?=3.0.17 3.1.12 3.2.24 3.3.17 3.4.3 # LATEST_ETCD_VERSION identifies the most recent etcd version available. -LATEST_ETCD_VERSION?=3.3.17 +LATEST_ETCD_VERSION?=3.4.3 # REVISION provides a version number fo this image and all it's bundled # artifacts. It should start at zero for each LATEST_ETCD_VERSION and increment @@ -113,11 +113,16 @@ else arch_prefix="GOARM=$(GOARM)" endif + # use '/go/src/go.etcd.io/etcd' to build etcd 3.4 and later. for version in $(BUNDLED_ETCD_VERSIONS); do \ etcd_release_tmp_dir=$(shell mktemp -d); \ + etcd_build_dir="/go/src/github.com/coreos/etcd"; \ + if [ $$(echo $$version | cut -d. -f2) -gt 3 ]; then \ + etcd_build_dir="/go/src/go.etcd.io/etcd"; \ + fi; \ docker run --interactive -v $${etcd_release_tmp_dir}:/etcdbin golang:$(GOLANG_VERSION)$(DOCKER_VOL_OPTS) /bin/bash -c \ - "git clone https://github.com/coreos/etcd /go/src/github.com/coreos/etcd \ - && cd /go/src/github.com/coreos/etcd \ + "git clone https://github.com/coreos/etcd $$etcd_build_dir \ + && cd $$etcd_build_dir \ && git checkout v$${version} \ && $(arch_prefix) GOARCH=$(ARCH) ./build \ && cp -f bin/$(ARCH)/etcd* bin/etcd* /etcdbin; echo 'done'"; \ diff --git a/cluster/images/etcd/README.md b/cluster/images/etcd/README.md index c87843c34a3..4347df9c357 100644 --- a/cluster/images/etcd/README.md +++ b/cluster/images/etcd/README.md @@ -26,7 +26,7 @@ server. `migrate` writes a `version.txt` file to track the "current" version of etcd that was used to persist data to disk. A "target" version may also be provided -by the `TARGET_STORAGE` (e.g. "etcd3") and `TARGET_VERSION` (e.g. "3.3.15" ) +by the `TARGET_STORAGE` (e.g. "etcd3") and `TARGET_VERSION` (e.g. "3.4.3" ) environment variables. If the persisted version differs from the target version, `migrate-if-needed.sh` will migrate the data from the current to the target version. diff --git a/cluster/images/etcd/migrate-if-needed.sh b/cluster/images/etcd/migrate-if-needed.sh index fcea6099f58..59e6f4bb5f2 100755 --- a/cluster/images/etcd/migrate-if-needed.sh +++ b/cluster/images/etcd/migrate-if-needed.sh @@ -18,7 +18,8 @@ # This script performs etcd upgrade based on the following environmental # variables: # TARGET_STORAGE - API of etcd to be used (supported: 'etcd3') -# TARGET_VERSION - etcd release to be used (supported: '3.0.17', '3.1.12', '3.2.24', "3.3.17") +# TARGET_VERSION - etcd release to be used (supported: '3.0.17', '3.1.12', +# '3.2.24', "3.3.17", "3.4.3") # DATA_DIRECTORY - directory with etcd data # # The current etcd version and storage format is detected based on the @@ -29,6 +30,7 @@ # - 3.0.17/etcd3 -> 3.1.12/etcd3 # - 3.1.12/etcd3 -> 3.2.24/etcd3 # - 3.2.24/etcd3 -> 3.3.17/etcd3 +# - 3.3.17/etcd3 -> 3.4.3/etcd3 # # NOTE: The releases supported in this script has to match release binaries # present in the etcd image (to make this script work correctly). @@ -41,7 +43,7 @@ set -o nounset # NOTE: BUNDLED_VERSION has to match release binaries present in the # etcd image (to make this script work correctly). -BUNDLED_VERSIONS="3.0.17, 3.1.12, 3.2.24, 3.3.17" +BUNDLED_VERSIONS="3.0.17, 3.1.12, 3.2.24, 3.3.17, 3.4.3" ETCD_NAME="${ETCD_NAME:-etcd-$(hostname)}" if [ -z "${DATA_DIRECTORY:-}" ]; then diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index c48cdf0d31f..c721af0521f 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -261,7 +261,7 @@ const ( MinExternalEtcdVersion = "3.2.18" // DefaultEtcdVersion indicates the default etcd version that kubeadm uses - DefaultEtcdVersion = "3.3.17-0" + DefaultEtcdVersion = "3.4.3-0" // PauseVersion indicates the default pause image version for kubeadm PauseVersion = "3.1" @@ -424,9 +424,9 @@ var ( 13: "3.2.24", 14: "3.3.10", 15: "3.3.10", - 16: "3.3.15-0", - 17: "3.3.17-0", - 18: "3.3.17-0", + 16: "3.3.17-0", + 17: "3.4.3-0", + 18: "3.4.3-0", } // KubeadmCertsClusterRoleName sets the name for the ClusterRole that allows diff --git a/cmd/kubeadm/app/images/images_test.go b/cmd/kubeadm/app/images/images_test.go index 899a1261bbd..7af0de3a7c3 100644 --- a/cmd/kubeadm/app/images/images_test.go +++ b/cmd/kubeadm/app/images/images_test.go @@ -108,7 +108,7 @@ func TestGetEtcdImage(t *testing.T) { Local: &kubeadmapi.LocalEtcd{}, }, }, - expected: "real.repo/etcd:3.3.15-0", + expected: "real.repo/etcd:3.3.17-0", }, { cfg: &kubeadmapi.ClusterConfiguration{ @@ -136,7 +136,7 @@ func TestGetEtcdImage(t *testing.T) { }, }, }, - expected: "override/etcd:3.3.15-0", + expected: "override/etcd:3.3.17-0", }, { expected: GetGenericImage(gcrPrefix, "etcd", constants.DefaultEtcdVersion), diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 0267b5d26a6..13164f77a5b 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -16,7 +16,7 @@ # A set of helpers for starting/running etcd for tests -ETCD_VERSION=${ETCD_VERSION:-3.3.17} +ETCD_VERSION=${ETCD_VERSION:-3.4.3} ETCD_HOST=${ETCD_HOST:-127.0.0.1} ETCD_PORT=${ETCD_PORT:-2379} export KUBE_INTEGRATION_ETCD_URL="http://${ETCD_HOST}:${ETCD_PORT}" diff --git a/staging/src/k8s.io/sample-apiserver/artifacts/example/rc.yaml b/staging/src/k8s.io/sample-apiserver/artifacts/example/rc.yaml index 7ad023d9c5b..d4fe6a48dc9 100644 --- a/staging/src/k8s.io/sample-apiserver/artifacts/example/rc.yaml +++ b/staging/src/k8s.io/sample-apiserver/artifacts/example/rc.yaml @@ -25,4 +25,4 @@ spec: imagePullPolicy: Never args: [ "--etcd-servers=http://localhost:2379" ] - name: etcd - image: quay.io/coreos/etcd:v3.3.17 + image: quay.io/coreos/etcd:v3.4.3 diff --git a/test/e2e/framework/nodes_util.go b/test/e2e/framework/nodes_util.go index c6d690dfa55..cb38859f6f3 100644 --- a/test/e2e/framework/nodes_util.go +++ b/test/e2e/framework/nodes_util.go @@ -32,7 +32,7 @@ import ( e2essh "k8s.io/kubernetes/test/e2e/framework/ssh" ) -const etcdImage = "3.3.17-0" +const etcdImage = "3.4.3-0" // EtcdUpgrade upgrades etcd on GCE. func EtcdUpgrade(targetStorage, targetVersion string) error { diff --git a/test/utils/image/manifest.go b/test/utils/image/manifest.go index c085477ad7b..f22809bdb92 100644 --- a/test/utils/image/manifest.go +++ b/test/utils/image/manifest.go @@ -218,7 +218,7 @@ func initImageConfigs() map[int]Config { configs[CudaVectorAdd2] = Config{e2eRegistry, "cuda-vector-add", "2.0"} configs[Dnsutils] = Config{e2eRegistry, "dnsutils", "1.1"} configs[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"} - configs[Etcd] = Config{gcRegistry, "etcd", "3.3.17"} + configs[Etcd] = Config{gcRegistry, "etcd", "3.4.3"} configs[GBFrontend] = Config{sampleRegistry, "gb-frontend", "v6"} configs[GlusterDynamicProvisioner] = Config{dockerGluster, "glusterdynamic-provisioner", "v1.0"} configs[Httpd] = Config{dockerLibraryRegistry, "httpd", "2.4.38-alpine"} From ccf4caf30f77c20ebe39fea6335eb7e2d432be43 Mon Sep 17 00:00:00 2001 From: Jingyi Hu Date: Tue, 29 Oct 2019 13:10:29 -0700 Subject: [PATCH 2/2] Update etcd.sh to use v3 endpoint --- hack/lib/etcd.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/lib/etcd.sh b/hack/lib/etcd.sh index 13164f77a5b..c3d2fe98499 100755 --- a/hack/lib/etcd.sh +++ b/hack/lib/etcd.sh @@ -80,8 +80,8 @@ kube::etcd::start() { ETCD_PID=$! echo "Waiting for etcd to come up." - kube::util::wait_for_url "${KUBE_INTEGRATION_ETCD_URL}/v2/machines" "etcd: " 0.25 80 - curl -fs -X PUT "${KUBE_INTEGRATION_ETCD_URL}/v2/keys/_test" + kube::util::wait_for_url "${KUBE_INTEGRATION_ETCD_URL}/health" "etcd: " 0.25 80 + curl -fs -X POST "${KUBE_INTEGRATION_ETCD_URL}/v3/kv/put" -d '{"key": "X3Rlc3Q=", "value": ""}' } kube::etcd::stop() {