Files
kubernetes/pkg/kubelet
Kubernetes Submit Queue 02f803cc02 Merge pull request #52842 from yanxuean/reduntdant-cgroups
Automatic merge from submit-queue (batch tested with PRs 50457, 55558, 53483, 55731, 52842). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

improve the logic setting cgroupparent in RunPodSandbox

Signed-off-by: yanxuean <yan.xuean@zte.com.cn>

**What this PR does / why we need it**:
The setting of cgroupparent is too confused!
The old logic is:
1. set CgroupParent correctly
2. reset CgroupParent incorrectly
3. set CgroupParent again  (refer to #42055 )

The login is too confused, and It is sure that there are many people who drop in trap.
We only need to set it in one place.

kubernetes/pkg/kubelet/dockershim/docker_sandbox.go
```
func (ds *dockerService) makeSandboxDockerConfig(c *runtimeapi.PodSandboxConfig, image string) (*dockertypes.ContainerCreateConfig, error) {
        ....
       // Apply linux-specific options.
	if lc := c.GetLinux(); lc != nil {
		if err := ds.applySandboxLinuxOptions(hc, lc, createConfig, image, securityOptSep); err != nil {
			return nil, err
		}
	}

	// Apply resource options.
        setSandboxResources(hc)      **<-- reset the CgroupParent incorrectly**

       // Apply cgroupsParent derived from the sandbox config.
	if lc := c.GetLinux(); lc != nil {
		// Apply Cgroup options.
		cgroupParent, err := ds.GenerateExpectedCgroupParent(lc.CgroupParent)
		if err != nil {
			return nil, fmt.Errorf("failed to generate cgroup parent in expected syntax for container %q: %v", c.Metadata.Name, err)
		}
		hc.CgroupParent = cgroupParent
	}
```

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-11-18 11:36:26 -08:00
..
2017-10-15 18:18:13 -07:00
2017-11-09 12:14:08 +01:00
2017-10-15 18:18:13 -07:00
2017-11-09 12:14:08 +01:00
2017-10-15 18:18:13 -07:00
2017-10-15 18:18:13 -07:00
2017-10-15 18:18:13 -07:00
2017-10-15 18:18:13 -07:00
2017-11-10 13:14:40 +01:00
2017-10-17 11:31:46 +02:00
2017-11-09 12:14:08 +01:00
2017-10-15 18:18:13 -07:00
2017-11-09 12:14:08 +01:00
2017-10-27 15:16:53 +08:00
2017-11-14 17:18:17 +08:00
2017-10-15 18:18:13 -07:00
2017-11-09 12:14:08 +01:00
2017-11-09 12:14:08 +01:00
2017-11-09 12:14:08 +01:00
2017-06-22 11:31:03 -07:00
2017-06-22 11:31:03 -07:00
2017-07-10 14:05:46 -07:00
2017-07-19 11:33:06 +08:00
2017-11-10 13:14:40 +01:00