-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libct/configs: move cgroup configs to libct/cgroups #4472
Conversation
e90eb15
to
6b55c70
Compare
No longer a draft; PTAL @opencontainers/runc-maintainers 🙏🏻 This is the first step to implement the proposal to split libcontainer/cgroups out of runc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love the clean separation. thank you!
(please remove [draft]
from the PR title as well?)
|
||
import cg "github.com/opencontainers/runc/libcontainer/cgroups/configs" | ||
|
||
// Deprecated: use [github.com/opencontainers/runc/libcontainer/cgroups/configs]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really important (just an alternative) as these don't point to specific types, I think it's possible to just add the // Deprecated:
to the package;
package configs // Deprecated: use [github.com/opencontainers/runc/libcontainer/cgroups/configs].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
libcontainer/container_linux.go
Outdated
@@ -21,6 +21,7 @@ import ( | |||
"golang.org/x/sys/unix" | |||
|
|||
"github.com/opencontainers/runc/libcontainer/cgroups" | |||
cgConfig "github.com/opencontainers/runc/libcontainer/cgroups/configs" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you know if these types are also imported elsewhere separate from the cgroups
package itself? considering if that was not the case, these types could potentially be merged with the cgroups package 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
Looks like there's no need to have a separate package for cgroups-related structures.
The PR is now updated to use libcontainer/cgroups. The only negative effect is the patch is now bigger (had to replace configs
with cgroups
everywhere.
PTAL @thaJeztah 🙏🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I wanted to give the changes a quick try to see if nothing bad fell out of it, so I opened some test-PRs in moby to double-check;
efab503
to
157e5c6
Compare
These: > Error: libcontainer/cgroups/fs2/cpu.go:15:6: var-naming: func isCpuSet should be isCPUSet (revive) > func isCpuSet(r *cgroups.Resources) bool { > ^ > Error: libcontainer/cgroups/fs2/cpu.go:19:6: var-naming: func setCpu should be setCPU (revive) > func setCpu(dirPath string, r *cgroups.Resources) error { > ^ They are going to be shown after next commits because of linter-extra CI job (which, due to major changes, now thinks it's a new code so extra linters apply). Fixing it beforehand. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
We have quite a few external users of libcontainer/cgroups packages, and they all have to depend on libcontainer/configs as well. Let's move cgroup-related configuration to libcontainer/croups. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This PR moves cgroup-related configuration from libcontainer/configs to libcontainer/cgroups,
while providing backward-compatible aliases.
This is the first step to implement the proposal to split libcontainer/cgroups out of runc (which stems from this k8s discussion).