From 8946f2676983266a819de1292444a538acf5c2fe Mon Sep 17 00:00:00 2001 From: pacoxu Date: Mon, 1 Feb 2021 13:07:35 +0800 Subject: [PATCH] update pause to 3.4.1 for kubelet/kubeadm Signed-off-by: pacoxu --- build/dependencies.yaml | 6 ++-- cmd/kubeadm/app/constants/constants.go | 3 ++ cmd/kubeadm/app/constants/constants_unix.go | 3 -- .../app/constants/constants_windows.go | 3 -- cmd/kubeadm/app/images/BUILD | 13 ++----- cmd/kubeadm/app/images/images.go | 5 +++ cmd/kubeadm/app/images/images_unix.go | 29 ---------------- cmd/kubeadm/app/images/images_windows.go | 34 ------------------- cmd/kubeadm/app/phases/kubelet/flags_test.go | 4 +-- cmd/kubeadm/app/util/template_test.go | 6 ++-- cmd/kubelet/app/options/container_runtime.go | 2 +- pkg/kubelet/dockershim/docker_sandbox.go | 2 +- 12 files changed, 20 insertions(+), 90 deletions(-) delete mode 100644 cmd/kubeadm/app/images/images_unix.go delete mode 100644 cmd/kubeadm/app/images/images_windows.go diff --git a/build/dependencies.yaml b/build/dependencies.yaml index 794062a94e1..c521507d43e 100644 --- a/build/dependencies.yaml +++ b/build/dependencies.yaml @@ -160,9 +160,9 @@ dependencies: match: TAG = - name: "k8s.gcr.io/pause: dependents" - version: 3.2 + version: 3.4.1 refPaths: - - path: cmd/kubeadm/app/constants/constants_unix.go + - path: cmd/kubeadm/app/constants/constants.go match: PauseVersion\s+= - path: cmd/kubeadm/app/util/template_test.go match: validTmpl\s+= @@ -209,7 +209,7 @@ dependencies: - path: test/utils/runners.go match: k8s.gcr.io\/pause:\d+\.\d+ - path: test/utils/image/manifest.go - match: configs\[Pause\] = Config{gcRegistry, "pause", "\d+\.\d+"} + match: configs\[Pause\] = Config{gcRegistry, "pause", "\d+\.\d+.\d+"} # metadata-concealment: bump this one first - name: "metadata-concealment" diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index 57ddbcc5764..228ef196553 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -414,6 +414,9 @@ const ( ModeRBAC string = "RBAC" // ModeNode is an authorization mode that authorizes API requests made by kubelets. ModeNode string = "Node" + + // PauseVersion indicates the default pause image version for kubeadm + PauseVersion = "3.4.1" ) var ( diff --git a/cmd/kubeadm/app/constants/constants_unix.go b/cmd/kubeadm/app/constants/constants_unix.go index b024348c29a..16ff72d5556 100644 --- a/cmd/kubeadm/app/constants/constants_unix.go +++ b/cmd/kubeadm/app/constants/constants_unix.go @@ -21,7 +21,4 @@ package constants const ( // DefaultDockerCRISocket defines the default Docker CRI socket DefaultDockerCRISocket = "/var/run/dockershim.sock" - - // PauseVersion indicates the default pause image version for kubeadm - PauseVersion = "3.2" ) diff --git a/cmd/kubeadm/app/constants/constants_windows.go b/cmd/kubeadm/app/constants/constants_windows.go index e8b2494490a..6daae0a1fff 100644 --- a/cmd/kubeadm/app/constants/constants_windows.go +++ b/cmd/kubeadm/app/constants/constants_windows.go @@ -21,7 +21,4 @@ package constants const ( // DefaultDockerCRISocket defines the default Docker CRI socket DefaultDockerCRISocket = "npipe:////./pipe/docker_engine" - - // PauseVersion indicates the default pause image version for kubeadm - PauseVersion = "1.4.0" ) diff --git a/cmd/kubeadm/app/images/BUILD b/cmd/kubeadm/app/images/BUILD index cafd5e84f43..a4b8b898ddb 100644 --- a/cmd/kubeadm/app/images/BUILD +++ b/cmd/kubeadm/app/images/BUILD @@ -8,23 +8,14 @@ load( go_library( name = "go_default_library", - srcs = [ - "images.go", - "images_unix.go", - "images_windows.go", - ], + srcs = ["images.go"], importpath = "k8s.io/kubernetes/cmd/kubeadm/app/images", deps = [ "//cmd/kubeadm/app/apis/kubeadm:go_default_library", "//cmd/kubeadm/app/constants:go_default_library", "//cmd/kubeadm/app/util:go_default_library", "//vendor/k8s.io/klog/v2:go_default_library", - ] + select({ - "@io_bazel_rules_go//go/platform:windows": [ - "//cmd/kubeadm/app/apis/kubeadm/v1beta2:go_default_library", - ], - "//conditions:default": [], - }), + ], ) go_test( diff --git a/cmd/kubeadm/app/images/images.go b/cmd/kubeadm/app/images/images.go index ddb2a615790..88ab0cb91bc 100644 --- a/cmd/kubeadm/app/images/images.go +++ b/cmd/kubeadm/app/images/images.go @@ -121,3 +121,8 @@ func GetControlPlaneImages(cfg *kubeadmapi.ClusterConfiguration) []string { return imgs } + +// GetPauseImage returns the image for the "pause" container +func GetPauseImage(cfg *kubeadmapi.ClusterConfiguration) string { + return GetGenericImage(cfg.ImageRepository, "pause", constants.PauseVersion) +} diff --git a/cmd/kubeadm/app/images/images_unix.go b/cmd/kubeadm/app/images/images_unix.go deleted file mode 100644 index 43fa63e88cf..00000000000 --- a/cmd/kubeadm/app/images/images_unix.go +++ /dev/null @@ -1,29 +0,0 @@ -// +build !windows - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package images - -import ( - kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" - "k8s.io/kubernetes/cmd/kubeadm/app/constants" -) - -// GetPauseImage returns the image for the "pause" container -func GetPauseImage(cfg *kubeadmapi.ClusterConfiguration) string { - return GetGenericImage(cfg.ImageRepository, "pause", constants.PauseVersion) -} diff --git a/cmd/kubeadm/app/images/images_windows.go b/cmd/kubeadm/app/images/images_windows.go deleted file mode 100644 index f3c084a9483..00000000000 --- a/cmd/kubeadm/app/images/images_windows.go +++ /dev/null @@ -1,34 +0,0 @@ -// +build windows - -/* -Copyright 2020 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package images - -import ( - kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" - kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2" - "k8s.io/kubernetes/cmd/kubeadm/app/constants" -) - -// GetPauseImage returns the image for the "pause" container -func GetPauseImage(cfg *kubeadmapi.ClusterConfiguration) string { - //If user has configured the cluster to use a different image repository, use that for the Windows pause image. - if cfg.ImageRepository != kubeadmapiv1beta2.DefaultImageRepository { - return GetGenericImage(cfg.ImageRepository, "pause", constants.PauseVersion) - } - return GetGenericImage("mcr.microsoft.com/oss/kubernetes", "pause", constants.PauseVersion) -} diff --git a/cmd/kubeadm/app/phases/kubelet/flags_test.go b/cmd/kubeadm/app/phases/kubelet/flags_test.go index 4917a65f8c8..50a04588823 100644 --- a/cmd/kubeadm/app/phases/kubelet/flags_test.go +++ b/cmd/kubeadm/app/phases/kubelet/flags_test.go @@ -119,11 +119,11 @@ func TestBuildKubeletArgMap(t *testing.T) { nodeRegOpts: &kubeadmapi.NodeRegistrationOptions{ CRISocket: "/var/run/dockershim.sock", }, - pauseImage: "gcr.io/pause:3.2", + pauseImage: "gcr.io/pause:3.4.1", }, expected: map[string]string{ "network-plugin": "cni", - "pod-infra-container-image": "gcr.io/pause:3.2", + "pod-infra-container-image": "gcr.io/pause:3.4.1", }, }, } diff --git a/cmd/kubeadm/app/util/template_test.go b/cmd/kubeadm/app/util/template_test.go index c2dd0ed2454..3550f8f4f9e 100644 --- a/cmd/kubeadm/app/util/template_test.go +++ b/cmd/kubeadm/app/util/template_test.go @@ -21,9 +21,9 @@ import ( ) const ( - validTmpl = "image: {{ .ImageRepository }}/pause:3.2" - validTmplOut = "image: k8s.gcr.io/pause:3.2" - doNothing = "image: k8s.gcr.io/pause:3.2" + validTmpl = "image: {{ .ImageRepository }}/pause:3.4.1" + validTmplOut = "image: k8s.gcr.io/pause:3.4.1" + doNothing = "image: k8s.gcr.io/pause:3.4.1" invalidTmpl1 = "{{ .baz }/d}" invalidTmpl2 = "{{ !foobar }}" ) diff --git a/cmd/kubelet/app/options/container_runtime.go b/cmd/kubelet/app/options/container_runtime.go index b58953b88ef..a3be109f649 100644 --- a/cmd/kubelet/app/options/container_runtime.go +++ b/cmd/kubelet/app/options/container_runtime.go @@ -28,7 +28,7 @@ import ( const ( // When these values are updated, also update test/utils/image/manifest.go defaultPodSandboxImageName = "k8s.gcr.io/pause" - defaultPodSandboxImageVersion = "3.2" + defaultPodSandboxImageVersion = "3.4.1" ) var ( diff --git a/pkg/kubelet/dockershim/docker_sandbox.go b/pkg/kubelet/dockershim/docker_sandbox.go index 8408a2ccce3..5d4f97ddbb6 100644 --- a/pkg/kubelet/dockershim/docker_sandbox.go +++ b/pkg/kubelet/dockershim/docker_sandbox.go @@ -40,7 +40,7 @@ import ( ) const ( - defaultSandboxImage = "k8s.gcr.io/pause:3.2" + defaultSandboxImage = "k8s.gcr.io/pause:3.4.1" // Various default sandbox resources requests/limits. defaultSandboxCPUshares int64 = 2