Skip to content

Conversation

@kzys
Copy link
Member

@kzys kzys commented Oct 28, 2022

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!

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all


} else {
control, err := cgroups.Load(cgroups.V1, cgroups.StaticPath(cgroupPath))
control, err := cgroup1.Load(cgroup1.Default, cgroup1.StaticPath(cgroupPath))
Copy link
Member Author

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.

Copy link
Member

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

Comment on lines 31 to 37
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))
Copy link
Member Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, should be symmetrical

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kzys kzys force-pushed the cgroups-upgrade branch 3 times, most recently from 51e6c77 to e6f3928 Compare November 11, 2022 18:23
}
}

func printWindowsStats(w *tabwriter.Writer, windowsStats *wstats.Statistics) error {
Copy link
Member Author

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.

Comment on lines +27 to +28
v1 "github.com/containerd/cgroups/v3/cgroup1/stats"
v2 "github.com/containerd/cgroups/v3/cgroup2/stats"
Copy link
Member Author

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 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

@kzys kzys force-pushed the cgroups-upgrade branch 2 times, most recently from 8cd835a to 5d0bc24 Compare November 11, 2022 19:00
@kzys kzys changed the title Upgrade github.com/containerd/cgroups Upgrade github.com/containerd/cgroups from v1 to v3 Nov 11, 2022
@kzys
Copy link
Member Author

kzys commented Nov 11, 2022

I do believe that rockylinux/8 would be more stable after this upgrade because of containerd/cgroups#250.

Kazuyoshi Kato added 3 commits November 14, 2022 21:07
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>
@kzys kzys marked this pull request as ready for review November 14, 2022 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants