Skip to content

Commit

Permalink
Support K8s 1.24+
Browse files Browse the repository at this point in the history
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 <dxm523@gmail.com>
Change-Id: Ib44cc30285c8bd4219d4a45dc956696505ddd570
(cherry picked from commit f7cd292)
  • Loading branch information
Daniel Meyerholt authored and mnasiadka committed Mar 28, 2024
1 parent b85243e commit 9919749
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ if [ -f /etc/sysconfig/docker ] ; then
sed -i -E 's/^OPTIONS=("|'"'"')/OPTIONS=\1'"${DOCKER_OPTIONS}"' /' /etc/sysconfig/docker
fi

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

if [ -z "${KUBE_NODE_IP}" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
KUBELET_ARGS="${KUBELET_ARGS} --runtime-cgroups=/system.slice/containerd.service"
KUBELET_ARGS="${KUBELET_ARGS} --runtime-request-timeout=15m"
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime-endpoint=unix:///run/containerd/containerd.sock"
else
KUBELET_ARGS="${KUBELET_ARGS} --network-plugin=cni --cni-conf-dir=/etc/cni/net.d --cni-bin-dir=/opt/cni/bin"
fi

auto_healing_enabled=$(echo ${AUTO_HEALING_ENABLED} | tr '[:upper:]' '[:lower:]')
Expand All @@ -289,7 +291,6 @@ if [[ "${auto_healing_enabled}" = "true" && "${autohealing_controller}" = "drain
KUBELET_ARGS="${KUBELET_ARGS} --node-labels=draino-enabled=true"
fi

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

sed -i '
/^KUBELET_ADDRESS=/ s/=.*/="--address=0.0.0.0"/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
Support K8s 1.24 which removed support of dockershim. Needs containerd as
container runtime.

0 comments on commit 9919749

Please sign in to comment.