Project

General

Profile

Actions

action #137198

closed

Prepare cgroup-dependent test runs for container engines

Added by ph03nix 9 months ago. Updated 7 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Target version:
-
Start date:
2023-09-28
Due date:
% Done:

0%

Estimated time:

Description

In 15-SP6 we will have cgroups v2, previously we only had cgroups v1. Once released we need to test the container engines on both.

We should introduce a new setting, e.g. CGROUPS_VERSION that allows us to control which version a single test run is using. We don't need to support multiple cgroup versions per test run, one is enough.

This setting should make sure the appropriate cgroups settings are set in the kernel parameters (GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub). To enable v2, the systemd.unified_cgroup_hierarchy=1 setting should be set there.

Alternatively we can also use mount to check if cgroup2 is present in /sys/fs/cgroup.

# mount -l | grep cgroup
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,seclabel,nsdelegate)

We need to do this at least for podman and docker, and if possible for all other container engines as well.

Acceptance criteria

  • Introduce a new setting e.g. CGROUPS_VERSION that allows us to define the cgroups version to container engine test runs
  • Check if this can be applied on Tumbleweed (if there are still cgroups v1 possible) as testing ground because we cannot use cgroupsv2 on SLES15-SP5 and older
  • Schedule container engine tests using both cgroups versions, if possible on Tumbleweed

Related links

Actions #2

Updated by ph03nix 9 months ago

  • Subject changed from Prepare cgroup-dependent test runs to Prepare cgroup-dependent test runs for container engines
Actions #3

Updated by ph03nix 9 months ago

  • Description updated (diff)
Actions #4

Updated by ph03nix 9 months ago

We should perhaps check, if we can enable cgroups v2 on 15-SP5.

Actions #5

Updated by rpalethorpe 9 months ago

Hi, I just came across this while looking for a kernel related cgroup ticket.

FYI, In cases where both V1 and V2 are enabled (which unfortunately was the default in systemd for a while) you need to either check 'cgroup.controllers' to ensure the V2 controller versions are enabled or check 'mount' for the cgroup V1 controllers. It's possible to have both the cgroup2 mount present (there is only one for V2) and the V1 controller mounts.

On Tumbleweed cgroups V2 is the default AFAIK so we shouldn't need to do anything.

Actions #7

Updated by rbranco 7 months ago

  • Assignee set to rbranco
Actions #8

Updated by rbranco 7 months ago

From PED-5849:

2022-06: SLE15 SP4 adds support for unified hierarchy (defaults to hybrid)

Confirming with:
https://documentation.suse.com/sles/15-SP4/html/SLES-all/cha-tuning-cgroups.html

If I'm reading this right, we should also test 15-SP4+

Actions #9

Updated by ph03nix 7 months ago

rbranco wrote in #note-8:

From PED-5849:

2022-06: SLE15 SP4 adds support for unified hierarchy (defaults to hybrid)

Confirming with:
https://documentation.suse.com/sles/15-SP4/html/SLES-all/cha-tuning-cgroups.html

If I'm reading this right, we should also test 15-SP4+

Yes, I read it the same way. We should also test 15-SP4+.

Actions #10

Updated by rbranco 7 months ago

  • Status changed from Workable to In Progress
Actions #11

Updated by rbranco 7 months ago

Introduce CONTAINERS_CGROUPS_VERSION variable
https://github.com/os-autoinst/os-autoinst-distri-opensuse/pull/18201

TODO:

  • Add scheduling for TW on opensuse-jobgroups
  • Add scheduling for SLE 15-SP3+ on qac-openqa-yaml
Actions #12

Updated by rbranco 7 months ago

Opened bug:

podman fails to run containers when using hybrid cgroup hierarchy
https://bugzilla.opensuse.org/show_bug.cgi?id=1217590

Actions #13

Updated by rbranco 7 months ago

Add job for testing cgroup v1 on docker
https://github.com/os-autoinst/opensuse-jobgroups/pull/392

Actions #14

Updated by rbranco 7 months ago

Add docker_cgroupv2_tests to SLES 15-SP3+
https://gitlab.suse.de/qac/qac-openqa-yaml/-/merge_requests/1408

Actions #15

Updated by rbranco 7 months ago

Add cgroups v2 test to 15-SP3+ and cgroups v1 to 15-SP6+
https://gitlab.suse.de/qac/qac-openqa-yaml/-/merge_requests/1409

Actions #16

Updated by rbranco 7 months ago

  • Status changed from In Progress to Blocked
Actions #17

Updated by rbranco 7 months ago

Actions #18

Updated by rbranco 7 months ago

Kubernetes 1.25 adds official support for cgroup v2:
https://kubernetes.io/blog/2022/08/31/cgroupv2-ga-1-25/

Information for nerdctl:
https://github.com/containerd/nerdctl/blob/main/docs/faq.md#how-to-change-the-cgroup-driver

Rancher (k3s):
https://docs.k3s.io/advanced

Cgroup v1 and Hybrid v1/v2 are not supported; only pure Cgroup v2 is supported. If K3s fails to start due to missing cgroups when running rootless, it is likely that your node is in Hybrid mode, and the "missing" cgroups are still bound to a v1 controller.

Actions #19

Updated by rbranco 7 months ago

systemd 255 will be the last version supporting v1

Actions #20

Updated by rbranco 7 months ago

systemd version 256 will drop support for v1:
https://github.com/os-autoinst/opensuse-jobgroups/pull/399

Actions #21

Updated by rbranco 7 months ago

  • Status changed from Blocked to Resolved
Actions

Also available in: Atom PDF