Skip to content

Commit 3116747

Browse files
klihubaskervin
authored andcommitted
e2e: always configure systemd cgroup driver for containerd.
Containerd 2.1.x omits the cgroup driver default setting (SystemdCgroup = false) from the config file altogether. Our current e2e test provisioning and therefore fails to flip this setting to on. Switch to using imported config fragments to avoid this. Also switch forcing all plugins to enabled to use a config fragment. Signed-off-by: Krisztian Litkey <[email protected]>
1 parent 3a19c2e commit 3116747

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

test/e2e/playbook/provision.yaml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,34 @@
339339
- name: Configure containerd
340340
when: is_containerd
341341
block:
342-
- name: Create containerd configuration
343-
ansible.builtin.shell: "{{ item }}"
344-
with_items:
345-
- mkdir -p /etc/containerd
346-
- containerd config default > /etc/containerd/config.toml
347-
- sed -i 's/^.*disabled_plugins *= *.*$/disabled_plugins = []/' /etc/containerd/config.toml
348-
- sed -i 's/SystemdCgroup = false/SystemdCgroup = true/g' /etc/containerd/config.toml
342+
- name: Create drop-in directory (/etc/containerd/conf.d)
343+
ansible.builtin.file:
344+
path: /etc/containerd/conf.d
345+
state: directory
346+
347+
- name: Generate default configuration (/etc/containerd/config.toml)
348+
ansible.builtin.shell: containerd config default > /etc/containerd/config.toml
349+
350+
- name: Enable drop-in directory in configuration
351+
ansible.builtin.lineinfile:
352+
path: /etc/containerd/config.toml
353+
regexp: '^imports *=.*'
354+
line: 'imports = [ "/etc/containerd/conf.d/*.toml" ]'
355+
state: present
356+
357+
- name: Enable all plugins
358+
ansible.builtin.lineinfile:
359+
path: /etc/containerd/config.toml
360+
regexp: '^disabled_plugins *=.*'
361+
line: 'disabled_plugins = []'
362+
state: present
363+
364+
- name: Enable systemd cgroup driver
365+
ansible.builtin.copy:
366+
dest: /etc/containerd/conf.d/systemd-cgroup.toml
367+
content: |
368+
[plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runc.options]
369+
SystemdCgroup = true
349370
350371
- name: Update CNI plugin directory on Fedora
351372
when: ansible_facts['distribution'] == "Fedora"

0 commit comments

Comments
 (0)