k3s/pkg/kubelet/dockershim
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
..
cm a typo in dockershim.cm.containerManager.doWork 2017-10-24 22:51:47 +08:00
fixtures/seccomp Add the seccomp profile loading test to dockershim 2017-05-03 12:55:56 -07:00
libdocker Remove docker dep in kubelet startup 2017-11-01 10:03:01 +08:00
metrics update BUILD files 2017-10-15 18:18:13 -07:00
remote update BUILD files 2017-10-15 18:18:13 -07:00
testing dockershim: remove corrupt checkpoints immediately upon detection 2017-11-13 20:34:17 -06:00
BUILD dockershim: remove corrupt checkpoints immediately upon detection 2017-11-13 20:34:17 -06:00
convert.go Updates Docker Engine API 2017-07-13 12:55:07 -07:00
convert_test.go Updates Docker Engine API 2017-07-13 12:55:07 -07:00
doc.go Update CRI references 2017-06-09 10:16:40 +08:00
docker_checkpoint.go dockershim: remove corrupt checkpoints immediately upon detection 2017-11-13 20:34:17 -06:00
docker_checkpoint_test.go dockershim: checkpoint HostNetwork property 2017-06-21 13:10:47 -05:00
docker_container.go Remove docker dep in kubelet startup 2017-11-01 10:03:01 +08:00
docker_container_test.go Merge pull request #49107 from edevil/try_remove_old_log 2017-07-20 15:08:17 -07:00
docker_image.go Fix dockershim panic when listing images 2017-10-19 08:32:50 +08:00
docker_image_linux.go Implement CRI stats in dockershim for Windows 2017-10-02 04:10:48 +00:00
docker_image_test.go Updates Docker Engine API 2017-07-13 12:55:07 -07:00
docker_image_unsupported.go Implement CRI stats in dockershim for Windows 2017-10-02 04:10:48 +00:00
docker_image_windows.go Implement CRI stats in dockershim for Windows 2017-10-02 04:10:48 +00:00
docker_sandbox.go Merge pull request #52842 from yanxuean/reduntdant-cgroups 2017-11-18 11:36:26 -08:00
docker_sandbox_test.go dockershim: don't spam logs with pod IP errors before networking is ready 2017-06-12 15:07:38 -05:00
docker_service.go Return nil error if checkpoint returns with KeyNotFound error 2017-11-15 14:58:31 -08:00
docker_service_test.go dockershim: remove support for legacy containers 2017-09-11 08:44:27 -07:00
docker_stats_linux.go Implement CRI stats in dockershim for Windows 2017-10-02 04:10:48 +00:00
docker_stats_unsupported.go Implement CRI stats in dockershim for Windows 2017-10-02 04:10:48 +00:00
docker_stats_windows.go Implement CRI stats in dockershim for Windows 2017-10-02 04:10:48 +00:00
docker_streaming.go Fix TODO: rename podInfraContainerID to podSandboxID 2017-07-20 17:45:55 -07:00
exec.go kubelet: remove the --docker-exec-handler flag 2017-09-22 12:13:31 -07:00
helpers.go Sandbox Support for Windows + CNI 2017-11-02 17:40:20 -07:00
helpers_linux.go Sandbox Support for Windows + CNI 2017-11-02 17:40:20 -07:00
helpers_linux_test.go Rename runtime/default to docker default 2017-08-13 15:42:15 +08:00
helpers_test.go Use credentials from providers for docker sandbox image 2017-09-09 07:02:04 +08:00
helpers_unsupported.go Sandbox Support for Windows + CNI 2017-11-02 17:40:20 -07:00
helpers_windows.go Sandbox Support for Windows + CNI 2017-11-02 17:40:20 -07:00
naming.go Update CRI references 2017-06-09 10:16:40 +08:00
naming_test.go Update CRI references 2017-06-09 10:16:40 +08:00
security_context.go Merge pull request #47019 from jessfraz/allowPrivilegeEscalation 2017-07-31 16:56:58 -07:00
security_context_test.go Updates Docker Engine API 2017-07-13 12:55:07 -07:00
selinux_util.go dockershim: clean up unused security context code 2017-07-10 17:48:26 -07:00
selinux_util_test.go dockershim: clean up unused security context code 2017-07-10 17:48:26 -07:00