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

Delegate cgroup exists to systemd and libcontainer #102250

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/kubelet/cm/cgroup_manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,13 @@ func (m *cgroupManagerImpl) Exists(name CgroupName) bool {
if err != nil {
return false
}

// In case of systemd, it is responsible for ensuring the correct
// controllers are enabled.
if m.adapter.cgroupManagerType == libcontainerSystemd {
return true
}

difference := neededControllers.Difference(enabledControllers)
if difference.Len() > 0 {
klog.V(4).InfoS("The cgroup has some missing controllers", "cgroupName", name, "controllers", difference)
Expand All @@ -268,6 +275,13 @@ func (m *cgroupManagerImpl) Exists(name CgroupName) bool {
// Get map of all cgroup paths on the system for the particular cgroup
cgroupPaths := m.buildCgroupPaths(name)

// In case of systemd, it is responsible for ensuring the correct
// controllers are enabled. Only verify that directory on systemd
// mount exists
if m.adapter.cgroupManagerType == libcontainerSystemd {
return libcontainercgroups.PathExists(cgroupPaths["systemd"])
}

// the presence of alternative control groups not known to runc confuses
// the kubelet existence checks.
// ideally, we would have a mechanism in runc to support Exists() logic
Expand Down