-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Upgrade github.com/containerd/cgroups from v1 to v3 #7601
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
Conversation
|
Skipping CI for Draft Pull Request. |
819cd56 to
761679e
Compare
|
|
||
| } else { | ||
| control, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(cgroupPath)) | ||
| control, err := cgroup1.Load(cgroup1.Default, cgroup1.StaticPath(cgroupPath)) |
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.
Let me know your thoughts about this subtle renaming. I didn't like cgroup1.V1 and renamed that to cgroup1.Default.
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.
Maybe you can just drop the first arg
runtime/opts/opts_linux.go
Outdated
| cg, err := cgroup2.LoadManager("/sys/fs/cgroup", i.Name) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return cg.Delete() | ||
| } | ||
| cg, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(i.Name)) | ||
| cg, err := cgroup1.Load(cgroup1.Default, cgroup1.StaticPath(i.Name)) |
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.
We could also make LoadManager and Load more symmetric if we do want. Not really sure why cgroup2's one is called LoadManager.
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.
Yes, should be symmetrical
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.
Did in containerd/cgroups#259
51e6c77 to
e6f3928
Compare
| } | ||
| } | ||
|
|
||
| func printWindowsStats(w *tabwriter.Writer, windowsStats *wstats.Statistics) error { |
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.
This is a bit of hack due to hcsshim <-> containerd cyclic dependencies and the fact that hcsshim uses gogo/protobuf.
| v1 "github.com/containerd/cgroups/v3/cgroup1/stats" | ||
| v2 "github.com/containerd/cgroups/v3/cgroup2/stats" |
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.
I personally like this symmetric naming :)
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.
SGTM
8cd835a to
5d0bc24
Compare
|
I do believe that rockylinux/8 would be more stable after this upgrade because of containerd/cgroups#250. |
5d0bc24 to
15e4efc
Compare
37ac690 to
9c8949d
Compare
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
Since hcsshim still uses containerd/cgroups 1.x which uses gogo/protobuf. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
While containerd/cgroups is only for Linux, the metrics subcommand works on Windows. Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
9c8949d to
8bb5999
Compare
This PR moves containerd/cgroups from v1 to v3. We skipped v2 because v1.0.x is having containerd/cgroups/v2 and it confused Go (see containerd/cgroups#253 (comment)).
Since this is the first (and hopefully last) time to make breaking changes on the cgroups package, I have renamed a few packages/symbols. These changes were reviewed by @AkihiroSuda on the cgroups side, but please take a look and let me know your thoughts!