-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
converted pod_failure_by_litmus to use ansible k8s module
Signed-off-by: Jayadeep KM <[email protected]>
- Loading branch information
1 parent
842a05d
commit d9a6a2f
Showing
2 changed files
with
40 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
- name: Get a list of all pods from given namespace | ||
k8s_facts: | ||
kind: Pod | ||
namespace: "{{ a_ns }}" | ||
label_selectors: | ||
- "{{a_label}}" | ||
register: pod_list | ||
|
||
- name: Select a random pod to kill | ||
set_fact: | ||
a_pod_to_kill: "{{ pod_list.resources | random | json_query('metadata.name') }}" | ||
|
||
- debug: | ||
msg: "Killing pod {{a_pod_to_kill}}" | ||
|
||
- name: Force Kill application pod | ||
shell: | | ||
kubectl delete pod -n {{ a_ns }} --force --grace-period=0 --wait=false {{a_pod_to_kill}} | ||
args: | ||
executable: /bin/bash | ||
register: result | ||
when: "c_force == 'true'" | ||
|
||
- name: Kill application pod | ||
shell: | | ||
kubectl delete pod -n {{ a_ns }} --grace-period=0 --wait=false {{a_pod_to_kill}} | ||
args: | ||
executable: /bin/bash | ||
register: result | ||
when: "c_force == 'false' or c_force == ''" | ||
|
||
- debug: | ||
var: result | ||
|
||
- name: Wait for the interval timer | ||
pause: | ||
seconds: "{{c_interval}}" |
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