Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (m *containerRuntimeManager) getCgroupName(pod *v1.Pod, containerID string)

switch m.cgroupDriver {
case "systemd":
return fmt.Sprintf("%s/%s-%s.scope", cgroupName.ToSystemd(), m.runtimeName, containerID), nil
return fmt.Sprintf("%s/%s-%s.scope", cgroupName.ToSystemd(), cgroup.SystemdPathPrefixOfRuntime(m.runtimeName), containerID), nil
case "cgroupfs":
return fmt.Sprintf("%s/%s", cgroupName.ToCgroupfs(), containerID), nil
default:
Expand Down
14 changes: 14 additions & 0 deletions pkg/utils/cgroup/cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strings"

cgroupsystemd "github.com/opencontainers/runc/libcontainer/cgroups/systemd"

"k8s.io/klog"
)

// CgroupName is the abstract name of a cgroup prior to any driver specific conversion.
Expand Down Expand Up @@ -66,3 +68,15 @@ func escapeSystemdCgroupName(part string) string {
func (cgroupName CgroupName) ToCgroupfs() string {
return "/" + path.Join(cgroupName...)
}

func SystemdPathPrefixOfRuntime(runtimeName string) string {
switch runtimeName {
case "cri-o":
return "crio"
case "containerd":
return "cri-containerd"
default:
klog.Infof("prefix of container runtime %s was not tested. Maybe not correct!", runtimeName)
return runtimeName
}
}