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

Add checks in Create and Update Cgroup methods #28566

Conversation

dubstack
Copy link

@dubstack dubstack commented Jul 7, 2016

This PR is connected to upstream issue for adding pod level cgroups in Kubernetes: #27204
Libcontainer currently doesen't support updates to parent devices cgroups. Until we get libcontainer to support skipping devices cgroup we will have that logic on the kubelet side.
This PR includes:

  1. Skip the devices cgroup when updating a cgroup. We only update the memory and cpu subsytems.
  2. We explicitly pass all the cgroup paths that don't already exist to Apply()
  3. Adds an AlreadyExists() method which is a utility function to check if all the subsystems of a cgroup already exist.
    On cgroupManager.Update() we only call Set() and cgroupManager.Create() we only call Apply() method

@vishh PTAL

@dubstack dubstack added sig/node Categorizes an issue or PR as relevant to SIG Node. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jul 7, 2016
@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 7, 2016
@dubstack dubstack assigned vishh and unassigned yujuhong Jul 7, 2016
@@ -42,16 +45,40 @@ func NewCgroupManager(cs *cgroupSubsystems) CgroupManager {
}
}

// AlreadyExists checks if all subsystem cgroups already exist
func (m *cgroupManagerImpl) AlreadyExists(name string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Drop Already. Just Exists should do.

@vishh
Copy link
Contributor

vishh commented Jul 7, 2016

Add a fat comment explaining why the code cannot use libcontainer directly along with links to relevant issues.

@k8s-bot
Copy link

k8s-bot commented Jul 7, 2016

GCE e2e build/test passed for commit 422e99879a273eb30850f3e0ce4d2e1ce41a8dbc.

@dubstack dubstack force-pushed the dubstack-refactor-cgroup-manager branch from 422e998 to 79481d4 Compare July 7, 2016 01:56
@k8s-bot
Copy link

k8s-bot commented Jul 7, 2016

GCE e2e build/test passed for commit 79481d4c6522376d8d6af5a3c23c867f242f8985.

}
// If even one cgroup doesn't exist we go on to create it
for _, path := range cgroupPaths {
if !libcontainercgroups.PathExists(path) {
Copy link
Contributor

@jessfraz jessfraz Jul 7, 2016

Choose a reason for hiding this comment

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

could this be moved to the range above?

@dubstack dubstack force-pushed the dubstack-refactor-cgroup-manager branch from 79481d4 to dcfff45 Compare July 7, 2016 21:17
@k8s-bot
Copy link

k8s-bot commented Jul 7, 2016

GCE e2e build/test passed for commit dcfff45.

@dubstack
Copy link
Author

dubstack commented Jul 7, 2016

@jfrazelle Thanks for your comments. I ended up removing that part of the code. PTAL.
@vishh Can you please review once again

@dubstack
Copy link
Author

dubstack commented Jul 8, 2016

@vishh Can we get this merged?

@vishh vishh added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 8, 2016
@vishh vishh added this to the v1.4 milestone Jul 8, 2016
@vishh
Copy link
Contributor

vishh commented Jul 8, 2016

@dubstack can you mention your umbrella issue in all these PRs? It will be useful for tracking.

@dubstack
Copy link
Author

dubstack commented Jul 8, 2016

Done!

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Jul 9, 2016

GCE e2e build/test passed for commit dcfff45.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/node Categorizes an issue or PR as relevant to SIG Node. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants