mirror of https://github.com/k3s-io/k3s
![]() 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 ``` |
||
---|---|---|
.. | ||
BUILD | ||
apparmor.go | ||
autoscaling_utils.go | ||
configmap.go | ||
configmap_volume.go | ||
container_probe.go | ||
docker_containers.go | ||
downward_api.go | ||
downwardapi_volume.go | ||
empty_dir.go | ||
events.go | ||
expansion.go | ||
host_path.go | ||
init_container.go | ||
kubelet_etc_hosts.go | ||
networking.go | ||
pods.go | ||
privileged.go | ||
projected.go | ||
secrets.go | ||
secrets_volume.go | ||
sysctl.go | ||
util.go | ||
volumes.go |