enable compatibility with Nomad in cgroups.v2 mode #133
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.
This PR updates the containerd driver to support changes in how Nomad
manages cgroups when running on a machine using cgroups v2. The behavior
only activates on nodes where cgroups v2 are mounted at
/sys/fs/cgroup
(same as Nomad 1.3).
The namespace is now set to
nomad.slice
, which containerd uses asthe cgroup parent.
The container name is re-oriented to the new naming convention,
i.e.
<allocID>.<taskName>.scope
. This is necessary for Nomad tobe able to manage the cpuset resource.
Example
The OS / cgroup configuration
The
nomad.hcl
fileAn
example.nomad
job fileA
show.hcl
script for showing the cgroup interface filesAfter
nomad job run example.nomad
, run the script and get something likewhat cpuset is doing
8f979fe5
- cores 5 and 6 reserved, 10-11 shared5b918b66
- core 8 reserved, 10-11 sharedf97d44ae
- cores 3 and 4 reserved, 10-11 shared9b123379
- core 7 reserved, 10-11 shareda20c8758
- cores 0, 1, 2 reserved, 10-11 shared906e2bb5
- core 9 reserved, 10-11 shared