From af7bc17c9ac8e46f20cad4816378184b1fd1f297 Mon Sep 17 00:00:00 2001 From: qlijin Date: Tue, 31 Oct 2023 00:54:31 +0800 Subject: [PATCH] Spicify the runc path when we use the containerd container engine and change the bin_dir path. (#10154) * Specify the runc path when we use the containerd container engine and change the bin_dir path. Signed-off-by: Jin Li * Update roles/container-engine/containerd/templates/config.toml.j2 Co-authored-by: Arthur Outhenin-Chalandre --------- Signed-off-by: Jin Li Co-authored-by: Arthur Outhenin-Chalandre --- roles/container-engine/containerd/defaults/main.yml | 1 + roles/container-engine/containerd/templates/config.toml.j2 | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/roles/container-engine/containerd/defaults/main.yml b/roles/container-engine/containerd/defaults/main.yml index 05cfd95c189..da51a4cd02e 100644 --- a/roles/container-engine/containerd/defaults/main.yml +++ b/roles/container-engine/containerd/defaults/main.yml @@ -18,6 +18,7 @@ containerd_runc_runtime: base_runtime_spec: cri-base.json options: systemdCgroup: "{{ containerd_use_systemd_cgroup | ternary('true', 'false') }}" + binaryName: "{{ bin_dir }}/runc" containerd_additional_runtimes: [] # Example for Kata Containers as additional runtime: diff --git a/roles/container-engine/containerd/templates/config.toml.j2 b/roles/container-engine/containerd/templates/config.toml.j2 index fc3ea477faa..cc43a3df601 100644 --- a/roles/container-engine/containerd/templates/config.toml.j2 +++ b/roles/container-engine/containerd/templates/config.toml.j2 @@ -35,7 +35,11 @@ oom_score = {{ containerd_oom_score }} [plugins."io.containerd.grpc.v1.cri".containerd.runtimes.{{ runtime.name }}.options] {% for key, value in runtime.options.items() %} +{% if value | string != "true" and value | string != "false" %} + {{ key }} = "{{ value }}" +{% else %} {{ key }} = {{ value }} +{% endif %} {% endfor %} {% endfor %} {% if kata_containers_enabled %}