From 3281504a500138fcb30aefee558b837cf4d13e71 Mon Sep 17 00:00:00 2001 From: David Porter Date: Thu, 10 Feb 2022 14:17:44 -0800 Subject: [PATCH] cluster/ - Configure containerd only if necessary PR #107663 changed the startup logic to always call `SetupContainerd` which will generate a new containerd `/etc/containerd/config.toml` file. This is not always desired since some jobs install containerd from source and the containerd startup scripts (https://github.com/containerd/containerd/blob/main/contrib/gce/configure.sh) are responsible for generating the `/etc/containerd/config.toml` file. By always calling `SetupContainerd`, the containerd configuration by containerd's `configure.sh` will be overridden which breaks certain test jobs, see https://github.com/kubernetes/kubernetes/issues/107830. To fix this issue, only call `SetupContainerd` if `/etc/profile.d/containerd_env.sh` does not exist. When containerd `configure.sh` script will run, `/etc/profile.d/containerd_env.sh` will be written, and as a result the k8s setup scripts should avoid overriding the containerd configuration. Signed-off-by: David Porter --- cluster/gce/gci/configure-helper.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cluster/gce/gci/configure-helper.sh b/cluster/gce/gci/configure-helper.sh index 3bd20bf2399..7c982faf320 100644 --- a/cluster/gce/gci/configure-helper.sh +++ b/cluster/gce/gci/configure-helper.sh @@ -3442,7 +3442,12 @@ function main() { # stop docker if it is present as we want to use just containerd log-wrap 'StopDocker' systemctl stop docker || echo "unable to stop docker" fi - log-wrap 'SetupContainerd' setup-containerd + + if [[ ! -e "/etc/profile.d/containerd_env.sh" ]]; then + log-wrap 'SetupContainerd' setup-containerd + else + echo "Skipping SetupContainerd step because containerd has already been setup by containerd's configure.sh script" + fi log-start 'SetupKubePodLogReadersGroupDir' if [[ -n "${KUBE_POD_LOG_READERS_GROUP:-}" ]]; then