diff --git a/debian/build.go b/debian/build.go index b16ba7c9d22..64b1e216c03 100644 --- a/debian/build.go +++ b/debian/build.go @@ -23,7 +23,7 @@ const ( ChannelUnstable ChannelType = "unstable" ChannelNightly ChannelType = "nightly" - cniVersion = "0.5.1" + cniVersion = "0.6.0" ) type work struct { @@ -44,6 +44,7 @@ type version struct { GetVersion func() (string, error) GetDownloadLinkBase func(v version) (string, error) KubeadmKubeletConfigFile string + KubeletCNIVersion string } type cfg struct { @@ -291,6 +292,25 @@ func getKubeadmKubeletConfigFile(v version) (string, error) { } } +// 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) { + 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 sv.GTE(v190) { + return fmt.Sprintf("= %s", cniVersion), nil + } + return fmt.Sprint("= 0.5.1"), nil +} + func main() { flag.Parse() @@ -466,6 +486,11 @@ func main() { log.Fatalf("error getting kubeadm config: %v", err) } + c.KubeletCNIVersion, err = getKubeletCNIVersion(v) + if err != nil { + log.Fatalf("error getting kubelet config: %v", err) + } + return c.run() }); err != nil { log.Fatalf("err: %v", err) diff --git a/debian/xenial/kubelet/debian/control b/debian/xenial/kubelet/debian/control index 331c5d4137e..abcf2f461e7 100644 --- a/debian/xenial/kubelet/debian/control +++ b/debian/xenial/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 (>= 0.5.1), iproute2, socat, util-linux, mount, ebtables, ethtool, ${misc:Depends} +Depends: iptables (>= 1.4.21), kubernetes-cni ({{ .KubeletCNIVersion }}), iproute2, socat, util-linux, mount, ebtables, ethtool, ${misc:Depends} Description: Kubernetes Node Agent The node agent of Kubernetes, the container cluster manager diff --git a/debian/xenial/kubernetes-cni/debian/rules b/debian/xenial/kubernetes-cni/debian/rules index 368d88bdb42..293b2c7233f 100755 --- a/debian/xenial/kubernetes-cni/debian/rules +++ b/debian/xenial/kubernetes-cni/debian/rules @@ -2,15 +2,16 @@ # -*- makefile -*- #export DH_VERBOSE=1 -CNI_RELEASE = 0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff +CNI_VERSION = v0.6.0 build: echo noop binary: + mkdir -p ./bin curl -sSL --fail --retry 5 \ - "https://dl.k8s.io/network-plugins/cni-{{ .Arch }}-$(CNI_RELEASE).tar.gz" \ - | tar xz + "https://dl.k8s.io/network-plugins/cni-plugins-{{ .Arch }}-$(CNI_VERSION).tgz" \ + | tar -C ./bin -xz dh_testroot dh_auto_install dh_shlibdeps diff --git a/rpm/kubelet.spec b/rpm/kubelet.spec index 1b48c4b3869..3e138f9bca0 100644 --- a/rpm/kubelet.spec +++ b/rpm/kubelet.spec @@ -2,7 +2,6 @@ %global KUBE_MINOR 8 %global KUBE_PATCH 0 %global KUBE_VERSION %{KUBE_MAJOR}.%{KUBE_MINOR}.%{KUBE_PATCH} -%global CNI_RELEASE 0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff %global RPM_RELEASE 1 %global ARCH amd64 @@ -12,6 +11,12 @@ %define semver() (%1 * 256 * 256 + %2 * 256 + %3) %global KUBE_SEMVER %{semver %{KUBE_MAJOR} %{KUBE_MINOR} %{KUBE_PATCH}} +%if %{KUBE_SEMVER} >= %{semver 1 9 0} +%global CNI_VERSION 0.6.0 +%else +%global CNI_VERSION 0.5.1 +%endif + Name: kubelet Version: %{KUBE_VERSION} Release: %{RPM_RELEASE} @@ -24,12 +29,16 @@ Source1: kubelet.service Source2: https://dl.k8s.io/v%{KUBE_VERSION}/bin/linux/%{ARCH}/kubectl Source3: https://dl.k8s.io/v%{KUBE_VERSION}/bin/linux/%{ARCH}/kubeadm Source4: 10-kubeadm.conf -Source5: https://dl.k8s.io/network-plugins/cni-%{ARCH}-%{CNI_RELEASE}.tar.gz +%if %{KUBE_SEMVER} < %{semver 1 9 0} +Source5: https://dl.k8s.io/network-plugins/cni-%{ARCH}-0799f5732f2a11b329d9e3d51b9c8f2e3759f2ff.tar.gz +%else +Source5: https://dl.k8s.io/network-plugins/cni-plugins-%{ARCH}-v%{CNI_VERSION}.tgz +%endif BuildRequires: curl Requires: iptables >= 1.4.21 -Requires: kubernetes-cni >= 0.5.1 +Requires: kubernetes-cni = %{CNI_VERSION} Requires: socat Requires: util-linux Requires: ethtool @@ -42,7 +51,7 @@ The node agent of Kubernetes, the container cluster manager. %package -n kubernetes-cni -Version: 0.5.1 +Version: %{CNI_VERSION} Release: %{RPM_RELEASE} Summary: Binaries required to provision kubernetes container networking Requires: kubelet @@ -94,11 +103,13 @@ cp -p %SOURCE1 %{_builddir}/ cp -p %SOURCE2 %{_builddir}/ cp -p %SOURCE3 %{_builddir}/ cp -p %SOURCE4 %{_builddir}/ -%setup -D -T -a 5 -n %{_builddir}/ +%setup -c -D -T -a 5 -n cni-plugins %install +# The setup macro from prep will make install start in the cni-plugins directory, so cd back to the root. +cd %{_builddir} install -m 755 -d %{buildroot}%{_bindir} install -m 755 -d %{buildroot}%{_sysconfdir}/systemd/system/ install -m 755 -d %{buildroot}%{_sysconfdir}/systemd/system/kubelet.service.d/ @@ -112,10 +123,13 @@ install -p -m 755 -t %{buildroot}%{_sysconfdir}/systemd/system/ kubelet.service install -p -m 755 -t %{buildroot}%{_sysconfdir}/systemd/system/kubelet.service.d/ 10-kubeadm.conf -install -m 755 -d %{buildroot}/opt/cni -# bin directory from cni-amd64-%{CNI_RELEASE}.tar.gz with a list of cni plugins (among other things) -mv bin/ %{buildroot}/opt/cni/ - +install -m 755 -d %{buildroot}/opt/cni/bin +# bin directory from cni-plugins-%{ARCH}-%{CNI_VERSION}.tgz with a list of cni plugins (among other things) +%if %{KUBE_SEMVER} >= %{semver 1 9 0} +mv cni-plugins/* %{buildroot}/opt/cni/bin/ +%else +mv cni-plugins/bin/ %{buildroot}/opt/cni/ +%endif %files %{_bindir}/kubelet @@ -136,6 +150,9 @@ mv bin/ %{buildroot}/opt/cni/ %changelog +* Thu Oct 19 2017 Di Xu +- Bump CNI version to v0.6.0. + * Fri Sep 29 2017 Jacob Beacham - 1.8.0 - Bump version of kubelet and kubectl to v1.8.0.