This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
[WIP] Use format of the parent cgroup to determine whether to use cgroupfs or systemd cgroup driver #1071
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The parent cgroup will always be a systemd "slice" which can be detected by looking at a ".slice" suffix in the cgroup name. Use that information to drive whether to tell
runc
to use systemd or cgroupfs.The advantage of this approach is that the full control of which cgroup driver to use is now in the CRI client.
containerd-cri
will simply match what the CRI client requested, and askrunc
to do the same. This way it is possible to switch cgroup drivers by simply reconfiguring the CRI client (Kubelet.)Note: There's a corner case for the root slice, which in theory would be "/" for both cases and auto-detection would not work. But the correct way to specify the root slice for the systemd case is "-.slice" (or "/-.slice", since we only consider the last component of the path), so that corner case actually needs to be handled in the CRI client and not here.
This still needs testing! But sending it along to get some early feedback on the idea itself.
There are a few follow up commits updating comments, documentation and other minor fixes.
It's unclear to me what can be done about the
systemd_cgroup
field of Runtime.Options, since that seems to be part of an external API, so not sure how easy it can be deprecated... Opinions?/cc @Random-Liu @yujuhong