k3s/test/e2e/common
Kubernetes Submit Queue 84408378f9
Merge pull request #58174 from filbranden/ipcs1
Automatic merge from submit-queue. 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>.

Fixes for HostIPC tests to work when Docker has SELinux support enabled.

**What this PR does / why we need it**:

Fixes for HostIPC tests to work when Docker has SELinux support enabled.

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

N/A

**Special notes for your reviewer**:

The core of the matter is to use `ipcs` from util-linux rather than the one from busybox. The typical SELinux policy has enough to allow Docker containers (running under svirt_lxc_net_t SELinux type) to access IPC information by reading the contents of the files under /proc/sysvipc/, but not by using the shmctl etc. syscalls.

The `ipcs` implementation in busybox will use `shmctl(0, SHM_INFO, ...)` to detect whether it can read IPC info (see source code [here](https://git.busybox.net/busybox/tree/util-linux/ipcs.c?h=1_28_0#n138)), while the one in util-linux will prefer to read from the /proc files directly if they are available (see source code [here](https://github.com/karelzak/util-linux/blob/v2.27.1/sys-utils/ipcutils.c#L108)).

It turns out the SELinux policy doesn't allow the shmctl syscalls in an unprivileged container, while access to it through the /proc interface is fine. (One could argue this is a bug in the SELinux policy, but getting it fixed on stable OSs is hard, and it's not that hard for us to test it with an util-linux `ipcs`, so I propose we do so.)

This PR also contains a refactor of the code setting IpcMode, since setting it in the "common options" function is misleading, as on containers other than the sandbox, it ends up always getting overwritten, so let's only set it to "host" in the Sandbox.

It also has a minor fix for the `ipcmk` call, since support for size suffix was only introduced in recent versions of it.

**Release note**:

```release-note
NONE
```
2018-01-30 17:18:52 -08:00
..
BUILD Update generated files 2017-11-09 12:14:08 +01:00
apparmor.go Collect all the assorted image URLs from e2e tests in one place 2017-12-19 12:16:07 -05:00
autoscaling_utils.go pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
configmap.go Add dns, configmap, and custom resource definition conformance 2017-11-01 08:58:56 -07:00
configmap_volume.go Add a e2e test for binary data in configmap 2018-01-23 07:29:07 -05:00
container_probe.go Add framework.ConformanceIt as the new way to declare conformance tests. 2017-10-27 15:29:59 -07:00
docker_containers.go Add downward api and docker container conformance annotations 2017-10-30 16:00:41 -07:00
downward_api.go Combine downward api e2e test cases. 2017-11-14 09:51:35 +08:00
downwardapi_volume.go Add downward api and docker container conformance annotations 2017-10-30 16:00:41 -07:00
empty_dir.go Add empty dir and host related conformance annotations 2017-11-02 09:45:11 -07:00
events.go use core client with explicit version globally 2017-10-27 15:48:32 +08:00
expansion.go Add framework.ConformanceIt as the new way to declare conformance tests. 2017-10-27 15:29:59 -07:00
host_path.go Merge pull request #55009 from bradtopol/addhosteventsemptyconform2 2017-11-14 00:09:45 -08:00
init_container.go Merge pull request #51816 from liggitt/xiangpengzhao-remove-initc-anno 2017-09-03 17:35:11 -07:00
kubelet_etc_hosts.go Add empty dir and host related conformance annotations 2017-11-02 09:45:11 -07:00
networking.go Add framework.ConformanceIt as the new way to declare conformance tests. 2017-10-27 15:29:59 -07:00
pods.go Add framework.ConformanceIt as the new way to declare conformance tests. 2017-10-27 15:29:59 -07:00
privileged.go Port e2e tests for multi architecture 2017-09-01 05:40:52 +05:30
projected.go e2e: test containers projected volume updates should not exit 2017-11-27 09:33:20 -08:00
secrets.go Add framework.ConformanceIt as the new way to declare conformance tests. 2017-10-27 15:29:59 -07:00
secrets_volume.go Add framework.ConformanceIt as the new way to declare conformance tests. 2017-10-27 15:29:59 -07:00
sysctl.go pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
util.go Use ipc-utils container in HostIPC tests. 2018-01-25 11:09:16 -08:00
volumes.go if judgement always true in e2e 2017-10-30 08:55:51 +08:00