Skip to content

Commit

Permalink
Fix containerd runtime for releases older than 1.27
Browse files Browse the repository at this point in the history
  • Loading branch information
mnasiadka committed Nov 13, 2023
1 parent f894de1 commit d589f0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,14 @@ KUBELET_ARGS="${KUBELET_ARGS} --client-ca-file=${CERT_DIR}/ca.crt --tls-cert-fil

# specified cgroup driver
KUBELET_ARGS="${KUBELET_ARGS} --cgroup-driver=${CGROUP_DRIVER}"

if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
# check kubelet version, 1.27.0 dropped docker shim and --container-runtime command line option
KUBELET_VERSION=$(podman run ${CONTAINER_INFRA_PREFIX:-${HYPERKUBE_PREFIX}}hyperkube:${KUBE_TAG} kubelet --version | awk '{print $2}')
CONTAINER_RUNTIME_REMOTE_DROPPED="v1.27.0"
if [[ "${CONTAINER_RUNTIME_REMOTE_DROPPED}" != $(echo -e "${CONTAINER_RUNTIME_REMOTE_DROPPED}\n${KUBELET_VERSION}" | sort -V | head -n1) && "${KUBELET_VERSION}" != "devel" ]]; then
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime=remote"
fi
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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,12 @@ KUBELET_ARGS="${KUBELET_ARGS} --client-ca-file=${CERT_DIR}/ca.crt --tls-cert-fil
# specified cgroup driver
KUBELET_ARGS="${KUBELET_ARGS} --cgroup-driver=${CGROUP_DRIVER}"
if [ ${CONTAINER_RUNTIME} = "containerd" ] ; then
# check kubelet version, 1.27.0 dropped docker shim and --container-runtime command line option
KUBELET_VERSION=$(podman run ${CONTAINER_INFRA_PREFIX:-${HYPERKUBE_PREFIX}}hyperkube:${KUBE_TAG} kubelet --version | awk '{print $2}')
CONTAINER_RUNTIME_REMOTE_DROPPED="v1.27.0"
if [[ "${CONTAINER_RUNTIME_REMOTE_DROPPED}" != $(echo -e "${CONTAINER_RUNTIME_REMOTE_DROPPED}\n${KUBELET_VERSION}" | sort -V | head -n1) && "${KUBELET_VERSION}" != "devel" ]]; then
KUBELET_ARGS="${KUBELET_ARGS} --container-runtime=remote"
fi
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"
Expand Down

0 comments on commit d589f0f

Please sign in to comment.