-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add options for resource limits to podman_pod (#635)
* Add resource limiting paramters for podman_pod Signed-off-by: nishipy <goodisonev4@gmail.com> * Fix doc-elements-mismatch Signed-off-by: nishipy <goodisonev4@gmail.com> * Update tests for podman_pod Signed-off-by: nishipy <goodisonev4@gmail.com> --------- Signed-off-by: nishipy <goodisonev4@gmail.com>
- Loading branch information
Showing
4 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
38 changes: 38 additions & 0 deletions
38
tests/integration/targets/podman_pod/tasks/resource-limit.yml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
- name: Test podman_pod for limiting resources | ||
block: | ||
|
||
- name: Set variables for limiting resources | ||
set_fact: | ||
limit: | ||
blkio_weight: 123 | ||
cpuset_mems: '0-1' | ||
cpu_shares: 1024 | ||
device_write_bps: ['/dev/zero:1048576'] | ||
|
||
- name: Create pod for limiting resources | ||
containers.podman.podman_pod: | ||
name: limited-pod | ||
state: created | ||
blkio_weight: "{{ limit.blkio_weight }}" | ||
cpuset_mems: "{{ limit.cpuset_mems }}" | ||
cpu_shares: "{{ limit.cpu_shares }}" | ||
device_write_bps: "{{ limit.device_write_bps }}" | ||
|
||
- name: Get information on pod for limiting resources | ||
containers.podman.podman_pod_info: | ||
name: limited-pod | ||
register: pod_info | ||
|
||
- name: Check if the result is as expected | ||
assert: | ||
that: | ||
- item.blkio_weight == limit.blkio_weight | ||
- item.cpuset_mems == limit.cpuset_mems | ||
- item.cpu_shares == limit.cpu_shares | ||
with_items: "{{ pod_info.pods }}" | ||
|
||
always: | ||
- name: Cleanup | ||
containers.podman.podman_pod: | ||
name: limited-pod | ||
state: absent |