Add new ParseCgroupFileUnified method for k8s usage #4497
Closed
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.
In order to get k8s to drop usage of BOTH cgroups implementations in opencontainers/runc AND containerd/cgroups, we have to review what is being used in k8s from the latter. One thing that popped up is the following method defined in containerd/cgroups:
https://github.com/containerd/cgroups/blob/main/utils.go#L96-L98
Which is used here:
https://github.com/kubernetes/kubernetes/blob/69e30cd642be6eedaf320c98845f853ff52eff65/pkg/kubelet/kuberuntime/kuberuntime_container_linux.go#L355
Please do advise if there is a better way to do the same using existing methods here or we can add a new method in this PR that adjusts the existing implementation a bit to return the additional unified path.
Test case and code is adapted from containerd/cgroups: