Skip to content

Commit 6372102

Browse files
Daniel Meyerholtmnasiadka
authored andcommitted
Support K8s 1.24+
Only specify dockershim options when container runtime is not containerd. Those options were ignored in the past when using containerd but since 1.24 kubelet refuses to start. Task: 45282 Story: 2010028 Signed-off-by: Daniel Meyerholt <[email protected]> Change-Id: Ib44cc30285c8bd4219d4a45dc956696505ddd570
1 parent d716584 commit 6372102

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-master.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ if [ -f /etc/sysconfig/docker ] ; then
454454
sed -i -E 's/^OPTIONS=("|'"'"')/OPTIONS=\1'"${DOCKER_OPTIONS}"' /' /etc/sysconfig/docker
455455
fi
456456

457-
KUBELET_ARGS="${KUBELET_ARGS} --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
458457
KUBELET_ARGS="${KUBELET_ARGS} --register-with-taints=node-role.kubernetes.io/master=:NoSchedule"
459458
KUBELET_ARGS="${KUBELET_ARGS} --node-labels=magnum.openstack.org/role=${NODEGROUP_ROLE}"
460459
KUBELET_ARGS="${KUBELET_ARGS} --node-labels=magnum.openstack.org/nodegroup=${NODEGROUP_NAME}"
@@ -502,6 +501,8 @@ if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
502501
KUBELET_ARGS="${KUBELET_ARGS} --runtime-cgroups=/system.slice/containerd.service"
503502
KUBELET_ARGS="${KUBELET_ARGS} --runtime-request-timeout=15m"
504503
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
504+
else
505+
KUBELET_ARGS="${KUBELET_ARGS} --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
505506
fi
506507

507508
if [ -z "${KUBE_NODE_IP}" ]; then

magnum/drivers/common/templates/kubernetes/fragments/configure-kubernetes-minion.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
278278
KUBELET_ARGS="${KUBELET_ARGS} --runtime-cgroups=/system.slice/containerd.service"
279279
KUBELET_ARGS="${KUBELET_ARGS} --runtime-request-timeout=15m"
280280
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
281+
else
282+
KUBELET_ARGS="${KUBELET_ARGS} --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
281283
fi
282284

283285
auto_healing_enabled=$(echo ${AUTO_HEALING_ENABLED} | tr '[:upper:]' '[:lower:]')
@@ -286,7 +288,6 @@ if [[ "${auto_healing_enabled}" = "true" && "${autohealing_controller}" = "drain
286288
KUBELET_ARGS="${KUBELET_ARGS} --node-labels=draino-enabled=true"
287289
fi
288290

289-
KUBELET_ARGS="${KUBELET_ARGS} --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
290291

291292
sed -i '
292293
/^KUBELET_ADDRESS=/ s/=.*/="--address=0.0.0.0"/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
fixes:
3+
- |
4+
Support K8s 1.24 which removed support of dockershim. Needs containerd as
5+
container runtime.

0 commit comments

Comments
 (0)