MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / GenerateExpectedCgroupParent

Method GenerateExpectedCgroupParent

core/docker_service.go:444–457  ·  view source on GitHub ↗

GenerateExpectedCgroupParent returns cgroup parent in syntax expected by cgroup driver

(cgroupParent string)

Source from the content-addressed store, hash-verified

442
443// GenerateExpectedCgroupParent returns cgroup parent in syntax expected by cgroup driver
444func (ds *dockerService) GenerateExpectedCgroupParent(cgroupParent string) (string, error) {
445 if cgroupParent != "" {
446 // if docker uses the systemd cgroup driver, it expects *.slice style names for cgroup parent.
447 // if we configured kubelet to use --cgroup-driver=cgroupfs, and docker is configured to use systemd driver
448 // docker will fail to launch the container because the name we provide will not be a valid slice.
449 // this is a very good thing.
450 if ds.cgroupDriver == "systemd" {
451 // Pass only the last component of the cgroup path to systemd.
452 cgroupParent = path.Base(cgroupParent)
453 }
454 }
455 logrus.Debugf("Setting cgroup parent to (%s)", cgroupParent)
456 return cgroupParent, nil
457}
458
459// checkVersionCompatibility verifies whether docker is in a compatible version.
460func (ds *dockerService) checkVersionCompatibility() error {

Callers 2

applySandboxResourcesMethod · 0.95
updateCreateConfigMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected