Skip to content

Commit e0c7398

Browse files
mnasiadkaAlex-Welsh
authored andcommitted
Fix containerd runtime for releases older than 1.27
(cherry picked from commit d589f0f) (cherry picked from commit 3f901a5) (cherry picked from commit b4ed3ec) (cherry picked from commit 3cfccf6)
1 parent 23fedc6 commit e0c7398

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,14 @@ KUBELET_ARGS="${KUBELET_ARGS} --client-ca-file=${CERT_DIR}/ca.crt --tls-cert-fil
499499

500500
# specified cgroup driver
501501
KUBELET_ARGS="${KUBELET_ARGS} --cgroup-driver=${CGROUP_DRIVER}"
502+
502503
if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
504+
# check kubelet version, 1.27.0 dropped docker shim and --container-runtime command line option
505+
KUBELET_VERSION=$(podman run ${CONTAINER_INFRA_PREFIX:-${HYPERKUBE_PREFIX}}hyperkube:${KUBE_TAG} kubelet --version | awk '{print $2}')
506+
CONTAINER_RUNTIME_REMOTE_DROPPED="v1.27.0"
507+
if [[ "${CONTAINER_RUNTIME_REMOTE_DROPPED}" != $(echo -e "${CONTAINER_RUNTIME_REMOTE_DROPPED}\n${KUBELET_VERSION}" | sort -V | head -n1) && "${KUBELET_VERSION}" != "devel" ]]; then
508+
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime=remote"
509+
fi
503510
KUBELET_ARGS="${KUBELET_ARGS} --runtime-cgroups=/system.slice/containerd.service"
504511
KUBELET_ARGS="${KUBELET_ARGS} --runtime-request-timeout=15m"
505512
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime-endpoint=unix:///run/containerd/containerd.sock"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ KUBELET_ARGS="${KUBELET_ARGS} --client-ca-file=${CERT_DIR}/ca.crt --tls-cert-fil
278278
# specified cgroup driver
279279
KUBELET_ARGS="${KUBELET_ARGS} --cgroup-driver=${CGROUP_DRIVER}"
280280
if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
281+
# check kubelet version, 1.27.0 dropped docker shim and --container-runtime command line option
282+
KUBELET_VERSION=$(podman run ${CONTAINER_INFRA_PREFIX:-${HYPERKUBE_PREFIX}}hyperkube:${KUBE_TAG} kubelet --version | awk '{print $2}')
283+
CONTAINER_RUNTIME_REMOTE_DROPPED="v1.27.0"
284+
if [[ "${CONTAINER_RUNTIME_REMOTE_DROPPED}" != $(echo -e "${CONTAINER_RUNTIME_REMOTE_DROPPED}\n${KUBELET_VERSION}" | sort -V | head -n1) && "${KUBELET_VERSION}" != "devel" ]]; then
285+
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime=remote"
286+
fi
281287
KUBELET_ARGS="${KUBELET_ARGS} --runtime-cgroups=/system.slice/containerd.service"
282288
KUBELET_ARGS="${KUBELET_ARGS} --runtime-request-timeout=15m"
283289
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime-endpoint=unix:///run/containerd/containerd.sock"

0 commit comments

Comments
 (0)