Kubernetes Submit Queue
89e433fca1
Merge pull request #59404 from ohmystack/docker-mem-swap
Automatic merge from submit-queue (batch tested with PRs 50724, 59025, 59710, 59404, 59958). 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>.
dockertools: disable MemorySwap on Linux
In this commit, set `MemorySwap` the same with `Memory` to prevent using swap on Linux.
**What this PR does / why we need it**:
In #39731, @pires tried to disable swap on Linux by setting `MemorySwap` to 0.
However, according to [Docker's docs](https://docs.docker.com/config/containers/resource_constraints/#--memory-swap-details), setting `MemorySwap` to 0 is treated as unset, and its [default behavior](https://github.com/moby/moby/blob/v17.05.0-ce/daemon/daemon_unix.go#L266-L269) is to set to twice the size of `Memory`, which can still cause the container to use the swap.
**Which issue(s) this PR fixes** :
This issue was mentioned in this comment: https://github.com/kubernetes/kubernetes/issues/7294#issuecomment-362722637
**Special notes for your reviewer**:
1. For the case on Windows, we can still use the 0 because [Windows does not support `MemorySwap`](https://github.com/moby/moby/blob/v17.05.0-ce/daemon/daemon_windows.go#L185-L187).
2. There is another place using the `DefaultMemorySwap()` is for [sandbox](https://github.com/kubernetes/kubernetes/blob/v1.9.2/pkg/kubelet/dockershim/docker_sandbox.go#L505).
Maybe setting the sandbox's `MemorySwap` to 0 is fine. I didn't change that.
**Release note**:
```release-note
dockertools: disable memory swap on Linux.
```
2018-02-26 21:34:42 -08:00
..
2018-02-23 16:50:43 -05:00
2018-02-26 00:01:32 -08:00
2018-02-16 13:43:01 -08:00
2018-02-16 13:43:01 -08:00
2018-02-21 13:08:11 +01:00
2018-02-26 17:48:54 -08:00
2018-02-26 15:00:49 -08:00
2018-02-16 13:43:01 -08:00
2018-02-24 20:01:44 -08:00
2018-02-16 13:43:01 -08:00
2018-02-23 18:09:06 +01:00
2018-02-24 18:43:39 -08:00
2018-02-26 08:08:47 -05:00
2018-02-26 21:34:42 -08:00
2018-02-23 11:44:06 -08:00
2018-02-24 18:43:39 -08:00
2018-02-24 20:01:39 -08:00
2018-02-16 13:43:01 -08:00
2018-02-26 07:50:58 -08:00
2018-02-20 14:10:46 -08:00
2018-02-24 22:18:24 -08:00
2018-02-12 10:54:33 -05:00
2018-02-23 11:22:31 -08:00
2018-02-16 13:43:01 -08:00
2018-02-16 13:43:01 -08:00
2018-02-21 13:16:51 -08:00
2018-02-16 13:43:01 -08:00
2018-02-26 07:50:58 -08:00
2018-01-29 10:07:37 -08:00
2018-02-26 20:34:37 -08:00
2018-01-15 23:17:19 +08:00
2018-02-21 13:08:11 +01:00