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 <dxm523@gmail.com>
Change-Id: Ib44cc30285c8bd4219d4a45dc956696505ddd570
This commit is contained in:
Daniel Meyerholt 2022-05-28 12:43:45 +02:00
parent a5797a5eac
commit f7cd2928d6
3 changed files with 9 additions and 2 deletions

View File

@ -451,7 +451,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}"
@ -500,6 +499,8 @@ if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime=remote"
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

View File

@ -278,6 +278,8 @@ if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime=remote"
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:]')
@ -286,7 +288,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"/

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Support K8s 1.24 which removed support of dockershim. Needs containerd as
container runtime.