Fix container update resetting pidslimit on older API clients#38791
Merged
thaJeztah merged 1 commit intomoby:masterfrom Feb 27, 2019
Merged
Fix container update resetting pidslimit on older API clients#38791thaJeztah merged 1 commit intomoby:masterfrom
thaJeztah merged 1 commit intomoby:masterfrom
Conversation
Member
Author
|
ping @cpuguy83 @kolyshkin PTAL |
thaJeztah
commented
Feb 24, 2019
Member
Author
There was a problem hiding this comment.
Wondering what is the "idiomatic" way to set properties of embedded structs? Is this better?
Suggested change
| updateConfig.PidsLimit = nil | |
| updateConfig.Resources.PidsLimit = nil |
Member
There was a problem hiding this comment.
Hum, I tends to prefer the explicit way (aka updateConfig.Resources.PidsLimit) but not sure what is the "idiomatic" way 😅
Codecov Report
@@ Coverage Diff @@
## master #38791 +/- ##
=========================================
Coverage ? 36.44%
=========================================
Files ? 613
Lines ? 45847
Branches ? 0
=========================================
Hits ? 16710
Misses ? 26844
Partials ? 2293 |
Older API clients did not use a pointer for `PidsLimit`, so
API requests would always send `0`, resulting in any previous
value to be reset after an update:
Before this patch:
(using a 17.06 Docker CLI):
```bash
docker run -dit --name test --pids-limit=16 busybox
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16
docker container update --memory=100M --memory-swap=200M test
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
0
docker container exec test cat /sys/fs/cgroup/pids/pids.max
max
```
With this patch applied:
(using a 17.06 Docker CLI):
```bash
docker run -dit --name test --pids-limit=16 busybox
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16
docker container update --memory=100M --memory-swap=200M test
docker container inspect --format '{{json .HostConfig.PidsLimit}}' test
16
docker container exec test cat /sys/fs/cgroup/pids/pids.max
16
```
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
c74944c to
5861a0d
Compare
vdemeester
approved these changes
Feb 25, 2019
Member
There was a problem hiding this comment.
Hum, I tends to prefer the explicit way (aka updateConfig.Resources.PidsLimit) but not sure what is the "idiomatic" way 😅
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #32519
Older API clients did not use a pointer for
PidsLimit, so API requests would always send0, resulting in any previous value to be reset after an update:Before this patch:
(using a 17.06 Docker CLI):
With this patch applied:
(using a 17.06 Docker CLI):