From c20a749884c0fde4965ebb70be092c3a4122c5fd Mon Sep 17 00:00:00 2001 From: Stephen Augustus Date: Fri, 22 May 2020 23:08:28 -0400 Subject: [PATCH] Bundle CNI plugins (v0.8.6) in kubelet deb/rpm packages Signed-off-by: Stephen Augustus --- debian/bionic/kubelet/debian/control | 2 +- debian/bionic/kubelet/debian/rules | 4 ++ debian/bionic/kubernetes-cni/.gitignore | 1 - debian/bionic/kubernetes-cni/debian/changelog | 6 -- debian/bionic/kubernetes-cni/debian/compat | 1 - debian/bionic/kubernetes-cni/debian/control | 15 ----- debian/bionic/kubernetes-cni/debian/copyright | 18 ------ .../debian/kubernetes-cni.install | 1 - debian/bionic/kubernetes-cni/debian/rules | 25 -------- debian/build.go | 59 +++---------------- debian/build_test.go | 2 - rpm/kubelet.spec | 21 ++----- 12 files changed, 18 insertions(+), 137 deletions(-) delete mode 100644 debian/bionic/kubernetes-cni/.gitignore delete mode 100644 debian/bionic/kubernetes-cni/debian/changelog delete mode 100644 debian/bionic/kubernetes-cni/debian/compat delete mode 100644 debian/bionic/kubernetes-cni/debian/control delete mode 100644 debian/bionic/kubernetes-cni/debian/copyright delete mode 100644 debian/bionic/kubernetes-cni/debian/kubernetes-cni.install delete mode 100755 debian/bionic/kubernetes-cni/debian/rules diff --git a/debian/bionic/kubelet/debian/control b/debian/bionic/kubelet/debian/control index 8f945f62d40e..1448157c85d5 100644 --- a/debian/bionic/kubelet/debian/control +++ b/debian/bionic/kubelet/debian/control @@ -10,6 +10,6 @@ Vcs-Browser: https://github.com/kubernetes/kubernetes Package: kubelet Architecture: {{ .DebArch }} -Depends: iptables (>= 1.4.21), kubernetes-cni ({{ .KubeletCNIVersion }}), iproute2, socat, util-linux, mount, ebtables, ethtool, conntrack, ${misc:Depends} +Depends: iptables (>= 1.4.21), iproute2, socat, util-linux, mount, ebtables, ethtool, conntrack, ${misc:Depends}, ${shlibs:Depends} Description: Kubernetes Node Agent The node agent of Kubernetes, the container cluster manager diff --git a/debian/bionic/kubelet/debian/rules b/debian/bionic/kubelet/debian/rules index db2587dbd922..d24cbe8390fe 100755 --- a/debian/bionic/kubelet/debian/rules +++ b/debian/bionic/kubelet/debian/rules @@ -12,6 +12,10 @@ binary: -o usr/bin/kubelet \ "{{ .DownloadLinkBase }}/bin/linux/{{ .Arch }}/kubelet" chmod +x usr/bin/kubelet + mkdir -p ./bin + curl -sSL --fail --retry 5 \ + "https://storage.googleapis.com/k8s-artifacts-cni/release/v{{ .CNIVersion }}/cni-plugins-linux-{{ .Arch }}-v{{ .CNIVersion }}.tgz" \ + | tar -C ./bin -xz dh_testroot dh_auto_install dh_shlibdeps diff --git a/debian/bionic/kubernetes-cni/.gitignore b/debian/bionic/kubernetes-cni/.gitignore deleted file mode 100644 index e660fd93d319..000000000000 --- a/debian/bionic/kubernetes-cni/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin/ diff --git a/debian/bionic/kubernetes-cni/debian/changelog b/debian/bionic/kubernetes-cni/debian/changelog deleted file mode 100644 index 58f7eab85a76..000000000000 --- a/debian/bionic/kubernetes-cni/debian/changelog +++ /dev/null @@ -1,6 +0,0 @@ -kubernetes-cni ({{ .Version }}-{{ .Revision }}) {{ .DistroName }} {{ .Arch }}; urgency=optional - - * https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG.md - - -- Kubernetes Authors {{ date }} - diff --git a/debian/bionic/kubernetes-cni/debian/compat b/debian/bionic/kubernetes-cni/debian/compat deleted file mode 100644 index ec635144f600..000000000000 --- a/debian/bionic/kubernetes-cni/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/bionic/kubernetes-cni/debian/control b/debian/bionic/kubernetes-cni/debian/control deleted file mode 100644 index 4cd30f46b24d..000000000000 --- a/debian/bionic/kubernetes-cni/debian/control +++ /dev/null @@ -1,15 +0,0 @@ -Source: kubernetes-cni -Section: misc -Priority: optional -Maintainer: Kubernetes Authors -Build-Depends: curl, ca-certificates, debhelper (>= 8.0.0) -Standards-Version: 3.9.4 -Homepage: https://kubernetes.io -Vcs-Git: https://github.com/kubernetes/kubernetes.git -Vcs-Browser: https://github.com/kubernetes/kubernetes - -Package: kubernetes-cni -Architecture: {{ .DebArch }} -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: Kubernetes CNI - The binaries required to provision container networking diff --git a/debian/bionic/kubernetes-cni/debian/copyright b/debian/bionic/kubernetes-cni/debian/copyright deleted file mode 100644 index 382d7e8faafc..000000000000 --- a/debian/bionic/kubernetes-cni/debian/copyright +++ /dev/null @@ -1,18 +0,0 @@ -Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: kubernetes-cni -Source: https://github.com/kubernetes/kubernetes - -Files: * -Copyright: 2016 The Linux Foundation and its contributors -License: Apache-2.0 - 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. diff --git a/debian/bionic/kubernetes-cni/debian/kubernetes-cni.install b/debian/bionic/kubernetes-cni/debian/kubernetes-cni.install deleted file mode 100644 index 001a3b4c7b10..000000000000 --- a/debian/bionic/kubernetes-cni/debian/kubernetes-cni.install +++ /dev/null @@ -1 +0,0 @@ -bin/ opt/cni diff --git a/debian/bionic/kubernetes-cni/debian/rules b/debian/bionic/kubernetes-cni/debian/rules deleted file mode 100755 index d05b03aa0bff..000000000000 --- a/debian/bionic/kubernetes-cni/debian/rules +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- - -#export DH_VERBOSE=1 -CNI_VERSION = v0.7.5 - -build: - echo noop - -binary: - mkdir -p ./bin - curl -sSL --fail --retry 5 \ - "https://storage.googleapis.com/k8s-artifacts-cni/release/$(CNI_VERSION)/cni-plugins-linux-{{ .Arch }}-$(CNI_VERSION).tgz" \ - | tar -C ./bin -xz - dh_testroot - dh_auto_install - dh_shlibdeps - dh_install - dh_installdeb - dh_gencontrol - dh_md5sums - dh_builddeb - -%: - dh $@ diff --git a/debian/build.go b/debian/build.go index b431e49f6225..3dc192e5880d 100644 --- a/debian/build.go +++ b/debian/build.go @@ -39,7 +39,8 @@ const ( ChannelUnstable ChannelType = "unstable" ChannelNightly ChannelType = "nightly" - cniVersion = "0.7.5" + currentCNIVersion = "0.8.6" + minimumCNIVersion = "0.8.6" criToolsVersion = "1.13.0" pre180kubeadmconf = "pre-1.8/10-kubeadm.conf" pre1110kubeadmconf = "post-1.8/10-kubeadm.conf" @@ -63,8 +64,8 @@ type version struct { Channel ChannelType GetVersion func() (string, error) GetDownloadLinkBase func(v version) (string, error) + CNIVersion string KubeadmKubeletConfigFile string - KubeletCNIVersion string } type cfg struct { @@ -303,15 +304,9 @@ func getReleaseDownloadLinkBase(v version) (string, error) { } func getKubeadmDependencies(v version) (string, error) { - cniVersion, err := getKubeletCNIVersion(v) - if err != nil { - return "", err - } - deps := []string{ "kubelet (>= 1.13.0)", "kubectl (>= 1.13.0)", - fmt.Sprintf("kubernetes-cni (%s)", cniVersion), "${misc:Depends}", } sv, err := semver.Make(v.Version) @@ -362,23 +357,17 @@ func getKubeadmKubeletConfigFile(v version) (string, error) { return latestkubeadmconf, nil } -// CNI get bumped in 1.9, which is incompatible for kubelet<1.9. -// So we need to restrict the CNI version when install kubelet. -func getKubeletCNIVersion(v version) (string, error) { +func getCNIVersion(v version) (string, error) { sv, err := semver.Make(v.Version) if err != nil { return "", err } - v190, err := semver.Make("1.9.0-alpha.0") - if err != nil { - return "", err + if int(sv.Minor) == 16 { + return minimumCNIVersion, nil } - if sv.GTE(v190) { - return fmt.Sprintf(">= %s", cniVersion), nil - } - return fmt.Sprint("= 0.5.1"), nil + return currentCNIVersion, nil } // getCRIToolsVersion assumes v coming in is >= 1.11.0-alpha.0 @@ -455,27 +444,6 @@ func main() { }, }, }, - { - Package: "kubernetes-cni", - Distros: distros, - Versions: []version{ - { - Version: cniVersion, - Revision: revision, - Channel: ChannelStable, - }, - { - Version: cniVersion, - Revision: revision, - Channel: ChannelUnstable, - }, - { - Version: cniVersion, - Revision: revision, - Channel: ChannelNightly, - }, - }, - }, { Package: "kubeadm", Distros: distros, @@ -552,17 +520,6 @@ func main() { }, }, }, - { - Package: "kubernetes-cni", - Distros: distros, - Versions: []version{ - { - Version: cniVersion, - Revision: revision, - Channel: ChannelStable, - }, - }, - }, { Package: "kubeadm", Distros: distros, @@ -615,7 +572,7 @@ func main() { log.Fatalf("error getting kubeadm dependencies: %v", err) } - c.KubeletCNIVersion, err = getKubeletCNIVersion(v) + c.CNIVersion, err = getCNIVersion(v) if err != nil { log.Fatalf("error getting kubelet CNI Version: %v", err) } diff --git a/debian/build_test.go b/debian/build_test.go index 8debe5d97148..a8f561b70aae 100644 --- a/debian/build_test.go +++ b/debian/build_test.go @@ -80,7 +80,6 @@ func TestGetKubeadmDependencies(t *testing.T) { deps: []string{ "kubelet (>= 1.13.0)", "kubectl (>= 1.13.0)", - "kubernetes-cni (>= 0.7.5)", "${misc:Depends}", "cri-tools (>= 1.13.0)", }, @@ -91,7 +90,6 @@ func TestGetKubeadmDependencies(t *testing.T) { deps: []string{ "kubelet (>= 1.13.0)", "kubectl (>= 1.13.0)", - "kubernetes-cni (>= 0.7.5)", "${misc:Depends}", "cri-tools (>= 1.13.0)", }, diff --git a/rpm/kubelet.spec b/rpm/kubelet.spec index 175c2dd225c3..4ae72b63b02c 100644 --- a/rpm/kubelet.spec +++ b/rpm/kubelet.spec @@ -11,7 +11,7 @@ %define semver() (%1 * 256 * 256 + %2 * 256 + %3) %global KUBE_SEMVER %{semver %{KUBE_MAJOR} %{KUBE_MINOR} %{KUBE_PATCH}} -%global CNI_VERSION 0.7.5 +%global CNI_VERSION 0.8.6 %global CRI_TOOLS_VERSION 1.13.0 Name: kubelet @@ -33,7 +33,6 @@ Source7: https://github.com/kubernetes-sigs/cri-tools/releases/download/v%{CRI_T BuildRequires: systemd BuildRequires: curl Requires: iptables >= 1.4.21 -Requires: kubernetes-cni >= %{CNI_VERSION} Requires: socat Requires: util-linux Requires: ethtool @@ -45,16 +44,6 @@ Requires: conntrack %description The node agent of Kubernetes, the container cluster manager. -%package -n kubernetes-cni - -Version: %{CNI_VERSION} -Release: %{RPM_RELEASE} -Summary: Binaries required to provision kubernetes container networking -Requires: kubelet - -%description -n kubernetes-cni -Binaries required to provision container networking. - %package -n kubectl Version: %{KUBE_VERSION} @@ -71,7 +60,6 @@ Release: %{RPM_RELEASE} Summary: Command-line utility for administering a Kubernetes cluster. Requires: kubelet >= 1.13.0 Requires: kubectl >= 1.13.0 -Requires: kubernetes-cni >= 0.7.5 Requires: cri-tools >= 1.13.0 %description -n kubeadm @@ -137,12 +125,10 @@ mv cni-plugins/* %{buildroot}/opt/cni/bin/ %{_bindir}/kubelet %{_unitdir}/kubelet.service %{_sysconfdir}/kubernetes/manifests/ +/opt/cni %config(noreplace) %{_sysconfdir}/sysconfig/kubelet -%files -n kubernetes-cni -/opt/cni - %files -n kubectl %{_bindir}/kubectl @@ -157,6 +143,9 @@ mv cni-plugins/* %{buildroot}/opt/cni/bin/ %changelog +* Fri May 22 2020 Stephen Augustus - 1.18.4 +- Bundle CNI plugins (v0.8.6) in kubelet package + * Fri May 22 2020 Stephen Augustus - 1.18.4 - Source CNI plugins from https://storage.googleapis.com/k8s-artifacts-cni/release instead of https://dl.k8s.io/network-plugins