Commit f12eda87 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #38457 from resouer/fix-cgroup-cri

Automatic merge from submit-queue (batch tested with PRs 38419, 38457, 38607) Fix pod level QoS does not works on CRI dockershim Fixes: https://github.com/kubernetes/kubernetes/issues/38458 We did set `CgroupParent ` in `CreateContainer`, but the `HostConfig.Resources` which `CgroupParent` belongs to is override by the following code: ``` hc.CgroupParent = lc.GetCgroupParent() ... hc.Resources = dockercontainer.Resources{ Memory: rOpts.GetMemoryLimitInBytes(), ... } ``` That's why `HostConfig.CgroupParent` is always empty and pod level QoS does not work.
parents 5e6578a7 9170e94e
......@@ -124,14 +124,6 @@ func (ds *dockerService) CreateContainer(podSandboxID string, config *runtimeapi
Binds: generateMountBindings(config.GetMounts()),
}
// Apply cgroupsParent derived from the sandbox config.
if lc := sandboxConfig.GetLinux(); lc != nil {
// Apply Cgroup options.
// TODO: Check if this works with per-pod cgroups.
// TODO: we need to pass the cgroup in syntax expected by cgroup driver but shim does not use docker info yet...
hc.CgroupParent = lc.GetCgroupParent()
}
// Apply Linux-specific options if applicable.
if lc := config.GetLinux(); lc != nil {
// Apply resource options.
......@@ -154,6 +146,14 @@ func (ds *dockerService) CreateContainer(podSandboxID string, config *runtimeapi
applyContainerSecurityContext(lc, podSandboxID, createConfig.Config, hc)
}
// Apply cgroupsParent derived from the sandbox config.
if lc := sandboxConfig.GetLinux(); lc != nil {
// Apply Cgroup options.
// TODO: Check if this works with per-pod cgroups.
// TODO: we need to pass the cgroup in syntax expected by cgroup driver but shim does not use docker info yet...
hc.CgroupParent = lc.GetCgroupParent()
}
// Set devices for container.
devices := make([]dockercontainer.DeviceMapping, len(config.Devices))
for i, device := range config.Devices {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment