From 137aa37503f75fd01bee4e03e60b5dd1f12f890c Mon Sep 17 00:00:00 2001 From: Dave McCormick Date: Thu, 12 Apr 2018 10:36:36 +0100 Subject: [PATCH] fix: Bug/flannel cni binary install (#1235) Install cni binaries for legacy flannel install Fixes #1232 --- .../controlplane/config/templates/cloud-config-controller | 8 ++++++-- core/controlplane/config/templates/cloud-config-worker | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/controlplane/config/templates/cloud-config-controller b/core/controlplane/config/templates/cloud-config-controller index 95aed4586..7facb8aac 100644 --- a/core/controlplane/config/templates/cloud-config-controller +++ b/core/controlplane/config/templates/cloud-config-controller @@ -314,10 +314,14 @@ coreos: ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/manifests ExecStartPre=/usr/bin/mkdir -p /etc/kubernetes/cni/net.d ExecStartPre=/bin/sh -ec "find /etc/kubernetes/manifests /srv/kubernetes/manifests -maxdepth 1 -type f | xargs --no-run-if-empty sed -i 's|#ETCD_ENDPOINTS#|${ETCD_ENDPOINTS}|'" - {{ if (and (not .Kubernetes.Networking.SelfHosting.Enabled) .UseCalico) -}} + {{ if not .Kubernetes.Networking.SelfHosting.Enabled -}} + {{ if .UseCalico -}} ExecStartPre=/bin/sh -ec "find /etc/kubernetes/cni/net.d/ -maxdepth 1 -type f | xargs --no-run-if-empty sed -i 's|#ETCD_ENDPOINTS#|${ETCD_ENDPOINTS}|'" ExecStartPre=/usr/bin/docker run --rm -e SLEEP=false -e KUBERNETES_SERVICE_HOST= -e KUBERNETES_SERVICE_PORT= -v /opt/cni/bin:/host/opt/cni/bin {{ .CalicoCniImage.RepoWithTag }} /install-cni.sh - {{- end }} + {{ else -}} + ExecStartPre=/usr/bin/docker run --rm -v /opt/cni/bin:/host/opt/cni/bin {{.HyperkubeImage.RepoWithTag}} /bin/sh -ec 'cp -rp /opt/cni/bin/* /host/opt/cni/bin' + {{ end -}} + {{ end -}} ExecStart=/usr/lib/coreos/kubelet-wrapper \ --kubeconfig=/etc/kubernetes/kubeconfig/controller.yaml \ --require-kubeconfig \ diff --git a/core/controlplane/config/templates/cloud-config-worker b/core/controlplane/config/templates/cloud-config-worker index ebc0b3f10..57afd1880 100644 --- a/core/controlplane/config/templates/cloud-config-worker +++ b/core/controlplane/config/templates/cloud-config-worker @@ -353,8 +353,10 @@ coreos: cluster-health {{if .UseCalico -}} ExecStartPre=/usr/bin/docker run --rm -e SLEEP=false -e KUBERNETES_SERVICE_HOST= -e KUBERNETES_SERVICE_PORT= -v /opt/cni/bin:/host/opt/cni/bin {{ .CalicoCniImage.RepoWithTag }} /install-cni.sh + {{ else -}} + ExecStartPre=/usr/bin/docker run --rm -v /opt/cni/bin:/host/opt/cni/bin {{.HyperkubeImage.RepoWithTag}} /bin/sh -ec 'cp -rp /opt/cni/bin/* /host/opt/cni/bin' + {{ end -}} {{ end -}} - {{- end }} ExecStart=/usr/lib/coreos/kubelet-wrapper \ --cni-conf-dir=/etc/kubernetes/cni/net.d \ {{/* Work-around until https://github.com/kubernetes/kubernetes/issues/43967 is fixed via https://github.com/kubernetes/kubernetes/pull/43995 */ -}}