-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for pids_limit parameter in docker_container module #49319
Support for pids_limit parameter in docker_container module #49319
Conversation
Hi @akshay196, thank you for submitting this pull-request! |
The test
|
cbc3f3a
to
0b26242
Compare
@@ -408,6 +408,12 @@ | |||
description: | |||
- Set the PID namespace mode for the container. | |||
- Note that docker-py < 2.0 only supports 'host'. Newer versions allow all values supported by the docker daemon. | |||
pids_limit: | |||
description: | |||
- Set PID limit for the container. It accepts integer value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Set PID limit for the container. It accepts integer value. | |
- Set PID limit for the container. It accepts an integer value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
0b26242
to
1b99b28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good; I'll run some tests tomorrow, but I think this is ready to go!
@@ -1276,6 +1283,7 @@ def _host_config(self): | |||
device_write_bps='device_write_bps', | |||
device_read_iops='device_read_iops', | |||
device_write_iops='device_write_iops', | |||
pids_limit='pids_limit' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a nit: can you add a trailing comma, so that the next time someone adds something, there's no need to modify this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank for pointing.
This add pids_limit parameter support in docker_container module Fixes ansible#43337 Signed-off-by: Akshay <akshay@localhost.localdomain>
Signed-off-by: Akshay Gaikwad <akgaikwad001@gmail.com>
a63b404
to
45e10cc
Compare
@@ -1690,6 +1698,7 @@ def __init__(self, container, parameters): | |||
self.parameters_map['device_write_bps'] = 'device_write_bps' | |||
self.parameters_map['device_read_iops'] = 'device_read_iops' | |||
self.parameters_map['device_write_iops'] = 'device_write_iops' | |||
self.parameters_map['pids_limit'] = 'pids_limit' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not noticing this earlier, but this isn't necessary (and the four lines above aren't, either). The map is needed if the names are different (expected_*
vs. *
), and is not defined for most options. Can you remove this (and the four lines above)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense. Thank you for letting me know. I have made the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
state: started | ||
pids_limit: 10 | ||
force_kill: yes | ||
register: pids_limit_1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you adjust the tests simliar to the ones for dns_opts
, so that they also run through for docker-py < 1.10.0?
I tested this with docker-py 1.9.0, docker-py 1.10.0, and docker-3.6.0 (by running all integration tests). With the latter two, it worked fine. With docker-py 1.9.0, it (correctly) failed because |
The map is needed if the names are different. Signed-off-by: Akshay Gaikwad <akgaikwad001@gmail.com>
It also run for docker-py < 1.10.0 Signed-off-by: Akshay Gaikwad <akgaikwad001@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I'll retest with docker-py 1.9.0 and 1.10.0 and if it doesn't show something strange, it's shipit time ;)
It works flawlessly! shipit (ah, looks like ansibot already accepts shipit when it shows up in a sentence...) |
@akshay196 Thank you for this Feature PR Merged into |
@felixfontein Thank you for review. |
…49319) * Support for pids_limit parameter in docker_container module This add pids_limit parameter support in docker_container module Fixes ansible#43337 Signed-off-by: Akshay <akshay@localhost.localdomain> * Add changelog for pids_limit parameter Signed-off-by: Akshay Gaikwad <akgaikwad001@gmail.com> * Remove unnecessary lines of code The map is needed if the names are different. Signed-off-by: Akshay Gaikwad <akgaikwad001@gmail.com> * Update pids_limit option tests It also run for docker-py < 1.10.0 Signed-off-by: Akshay Gaikwad <akgaikwad001@gmail.com>
SUMMARY
This add pids_limit parameter support in docker_container module
Fixes #43337
ISSUE TYPE
COMPONENT NAME
docker_container
ADDITIONAL INFORMATION
Set pids limit as,