10000 Use namespace in default cgroup path by crosbymichael · Pull Request #1617 · containerd/containerd · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use namespace in default cgroup path #1617

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

Merged
merged 1 commit into from
Oct 10, 2017
Merged

Conversation

crosbymichael
Copy link
Member

By default, the generated spec will place containers in cgroups by their
ids, we need to use the namespace as the cgroup root to avoid
containers with the same name being placed in the same cgroup.

11:perf_event:/to/redis
10:freezer:/to/redis
9:memory:/to/redis
8:devices:/to/redis
7:net_cls,net_prio:/to/redis
6:pids:/to/redis
5:hugetlb:/to/redis
4:cpuset:/to/redis
3:blkio:/to/redis
2:cpu,cpuacct:/to/redis
1:name=systemd:/to/redis

11:perf_event:/te/redis
10:freezer:/te/redis
9:memory:/te/redis
8:devices:/te/redis
7:net_cls,net_prio:/te/redis
6:pids:/te/redis
5:hugetlb:/te/redis
4:cpuset:/te/redis
3:blkio:/te/redis
2:cpu,cpuacct:/te/redis
1:name=systemd:/te/redis

Signed-off-by: Michael Crosby crosbymichael@gmail.com

@crosbymichael crosbymichael force-pushed the 2cgroup branch 2 times, most recently from 47cd76f to 39650f5 Compare October 9, 2017 20:15
@codecov-io
Copy link
codecov-io commented Oct 9, 2017

Codecov Report

Merging #1617 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1617   +/-   ##
=======================================
  Coverage   46.44%   46.44%           
=======================================
  Files          26       26           
  Lines        3542     3542           
=======================================
  Hits         1645     1645           
  Misses       1519     1519           
  Partials      378      378

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72bb45a...d7864eb. Read the comment docs.

Copy link
Contributor
@mlaventure mlaventure left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -63,7 +65,7 @@ func BenchmarkContainerStart(b *testing.B) {
b.Error(err)
return
}
spec, err := GenerateSpec(ctx, client, nil, WithImageConfig(image), withTrue())
spec, err := GenerateSpec(ctx, client, &containers.Container{ID: b.Name()}, WithImageConfig(image), withTrue())
Copy link
Member

Choose a reason for hiding this comment

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

what's the significance of adding an "empty" container with the name filled in for ID? I only ask because our examples still show nil here and other than being passed to the options helpers, I don't see what GenerateSpec does with it.

Copy link
Member Author

Choose a reason for hiding this comment

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

it panics

Copy link
Contributor

Choose a reason for hiding this comment

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

Caught my eyes too, I think it was only because it's part of SpecOpt signature. Maybe we should replace it with ID directly there.

Copy link
Member Author

Choose a reason for hiding this comment

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

other spec opts use this for more info, like rootfs and snapshotter

Copy link
Member

Choose a reason for hiding this comment

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

of course it panics.. my eyes were obviously not following the code path :) Anyway..I'm fine generating a separate PR to update the getting started and README.md examples that are passing nil if that's what we want to do.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the getting started doc

Copy link
Member
@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

My comment/question is only for understanding if we need any update to docs about this.

By default, the generated spec will place containers in cgroups by their
ids, we need to use the namespace as the cgroup root to avoid
containers with the same name being placed in the same cgroup.

```
11:perf_event:/to/redis
10:freezer:/to/redis
9:memory:/to/redis
8:devices:/to/redis
7:net_cls,net_prio:/to/redis
6:pids:/to/redis
5:hugetlb:/to/redis
4:cpuset:/to/redis
3:blkio:/to/redis
2:cpu,cpuacct:/to/redis
1:name=systemd:/to/redis

11:perf_event:/te/redis
10:freezer:/te/redis
9:memory:/te/redis
8:devices:/te/redis
7:net_cls,net_prio:/te/redis
6:pids:/te/redis
5:hugetlb:/te/redis
4:cpuset:/te/redis
3:blkio:/te/redis
2:cpu,cpuacct:/te/redis
1:name=systemd:/te/redis
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
@crosbymichael
Copy link
Member Author

@estesp i see you thumbs up but no merge? Is that how its going to be?

@estesp
Copy link
Member
estesp commented Oct 10, 2017

Fine..merging 😆

@estesp estesp merged commit 1ea8ac4 into containerd:master Oct 10, 2017
@Random-Liu
Copy link
Member
Random-Liu commented Oct 11, 2017

@crosbymichael Can we make this an option? Or have another pure default spec function?
We really don't need this because we have our own cgroup hierarchy.

@mlaventure
Copy link
Contributor

@Random-Liu aren't you using WithCgroup() when generating your spec? It would override this.

@crosbymichael crosbymichael deleted the 2cgroup branch October 11, 2017 14:58
@crosbymichael
Copy link
Member Author

@Random-Liu i thought you were overriding the cgroup path anyways

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.

5 participants
0