Skip to content
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

run: Add cgroup-parent flag #1782

Merged
merged 1 commit into from
Jan 1, 2023
Merged

Conversation

dcantah
Copy link
Member

@dcantah dcantah commented Dec 29, 2022

Adds a test case and the functionality for cgroup-parent to match docker runs support.

@dcantah dcantah force-pushed the cgroup-parent branch 2 times, most recently from 5f8137e to 2d0f05b Compare December 30, 2022 11:07
@dcantah dcantah marked this pull request as ready for review December 30, 2022 11:59
@dcantah dcantah added the enhancement New feature or request label Dec 30, 2022
@dcantah dcantah added this to the v1.2.0 milestone Dec 30, 2022
}

if cpus > 0.0 || memStr != "" || memSwap != "" || pidsLimit > 0 {
logrus.Warn("cgroup manager is set to \"none\", discarding resource limit requests. " +
logrus.Warn(`cgroup manager is set to "none", discarding resource limit requests. ` +
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for this change?

if cgroupManager == "none" {
if !rootlessutil.IsRootless() {
return nil, errors.New("cgroup-manager \"none\" is only supported for rootless")
return nil, errors.New(`cgroup-manager "none" is only supported for rootless`)
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Feel like raw string literals fit nicer than manually escaping quotes and other things. Also a habit from windows land where you'd commonly have to escape backslashes, so raw string literals came in handy there.

base := testutil.NewBase(t)
info := base.Info()
containerName := testutil.Identifier(t)
defer base.Cmd("rm", "-f", containerName).Run()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be AssertOK; since bugs were found in the past of containers leaked out.

Copy link
Member Author

@dcantah dcantah Jan 1, 2023

Choose a reason for hiding this comment

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

Are you referring to the deferred cleanup? I was just following the standard set in most of the other tests in this file, but seems it's actually the lesser used of the two when taking into account all of the other tests; only run_cgroup_linux_test and run_mount_linux_test just defer Run and call it a day. I'll open up a PR to swap the cgroup tests to using AssertOK instead (and use AssertOK here)

Copy link
Member Author

Choose a reason for hiding this comment

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

cmd/nerdctl/run_cgroup_linux_test.go Outdated Show resolved Hide resolved
cmd/nerdctl/run_cgroup_linux_test.go Outdated Show resolved Hide resolved
Adds a test case and the functionality for cgroup-parent to match docker runs support.

Signed-off-by: Danny Canter <danny@dcantah.dev>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

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

Thanks

@AkihiroSuda AkihiroSuda merged commit 3f3eb4d into containerd:main Jan 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants