Skip to content

Commit c4ef6a9

Browse files
committed
Add gid to config.toml only when docker group is present
If we don't install docker and install just containerd apt packages, there is no docker group. In this scenario, we should not add the gid to config.toml
1 parent 415b3ed commit c4ef6a9

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

cluster/gce/gci/configure-helper.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,8 +2668,6 @@ EOF
26682668
cni_template_path=""
26692669
fi
26702670
fi
2671-
# Reuse docker group for containerd.
2672-
local containerd_gid="$(cat /etc/group | grep ^docker: | cut -d: -f 3)"
26732671
cat > "${config_path}" <<EOF
26742672
# Kubernetes doesn't use containerd restart manager.
26752673
disabled_plugins = ["restart"]
@@ -2678,9 +2676,6 @@ oom_score = -999
26782676
[debug]
26792677
level = "${CONTAINERD_LOG_LEVEL:-"info"}"
26802678
2681-
[grpc]
2682-
gid = ${containerd_gid}
2683-
26842679
[plugins.cri]
26852680
stream_server_address = "127.0.0.1"
26862681
max_container_log_line_size = ${CONTAINERD_MAX_CONTAINER_LOG_LINE:-262144}
@@ -2691,6 +2686,16 @@ oom_score = -999
26912686
[plugins.cri.registry.mirrors."docker.io"]
26922687
endpoint = ["https://mirror.gcr.io","https://registry-1.docker.io"]
26932688
EOF
2689+
2690+
# Reuse docker group for containerd.
2691+
local containerd_gid="$(cat /etc/group | grep ^docker: | cut -d: -f 3)"
2692+
if [[ ! -z "${containerd_gid:-}" ]]; then
2693+
cat >> "${config_path}" <<EOF
2694+
# reuse id of the docker group
2695+
[grpc]
2696+
gid = ${containerd_gid}
2697+
EOF
2698+
fi
26942699
chmod 644 "${config_path}"
26952700

26962701
echo "Restart containerd to load the config change"

0 commit comments

Comments
 (0)