(feat): Added rescue block in pod-delete by powerseal lib (#1085)
Signed-off-by: shubhamchaudhary <shubham.chaudhary@mayadata.io> Co-authored-by: Amit Bhatt <33670159+amitbhatt818@users.noreply.github.com>
This commit is contained in:
parent
a0b92ea50d
commit
2ec1f03f53
|
|
@ -1,3 +1,5 @@
|
||||||
|
- block:
|
||||||
|
|
||||||
- name: Generate the powerfulseal deployment spec from template
|
- name: Generate the powerfulseal deployment spec from template
|
||||||
template:
|
template:
|
||||||
src: /chaoslib/powerfulseal/powerfulseal.j2
|
src: /chaoslib/powerfulseal/powerfulseal.j2
|
||||||
|
|
@ -8,8 +10,8 @@
|
||||||
kubectl apply -f powerfulseal.yml -n {{ a_ns }}
|
kubectl apply -f powerfulseal.yml -n {{ a_ns }}
|
||||||
args:
|
args:
|
||||||
executable: /bin/bash
|
executable: /bin/bash
|
||||||
register: result
|
register: deployment_result
|
||||||
failed_when: "result.rc != 0"
|
failed_when: "deployment_result.rc != 0"
|
||||||
|
|
||||||
- name: Confirm that powerfulseal pod is running
|
- name: Confirm that powerfulseal pod is running
|
||||||
shell: >
|
shell: >
|
||||||
|
|
@ -33,12 +35,38 @@
|
||||||
failed_when: "result.rc != 0"
|
failed_when: "result.rc != 0"
|
||||||
|
|
||||||
- name: Confirm that powerfulseal pod is cleaned up
|
- name: Confirm that powerfulseal pod is cleaned up
|
||||||
shell: >
|
k8s_facts:
|
||||||
kubectl get pod -l name=powerfulseal --no-headers -n {{ a_ns }}
|
kind: Deployment
|
||||||
args:
|
label_selectors:
|
||||||
executable: /bin/bash
|
- name=powerfulseal
|
||||||
register: result
|
register: resource_deployment
|
||||||
until: "'Running' not in result.stdout"
|
until: "resource_deployment.resources | length < 1"
|
||||||
delay: 1
|
delay: 1
|
||||||
retries: 120
|
retries: 120
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
|
||||||
|
- block:
|
||||||
|
|
||||||
|
- name: Tear down the powerfulseal deployment
|
||||||
|
shell: >
|
||||||
|
kubectl delete -f powerfulseal.yml -n {{ a_ns }}
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
when: deployment_result.rc == 0
|
||||||
|
|
||||||
|
- name: Confirm that powerfulseal pod is cleaned up
|
||||||
|
k8s_facts:
|
||||||
|
kind: Deployment
|
||||||
|
label_selectors:
|
||||||
|
- name=powerfulseal
|
||||||
|
register: resource_deployment
|
||||||
|
until: "resource_deployment.resources | length < 1"
|
||||||
|
delay: 1
|
||||||
|
retries: 120
|
||||||
|
|
||||||
|
when: "deployment_result is defined"
|
||||||
|
|
||||||
|
- fail:
|
||||||
|
msg: "pod_failure_by_powerfulseal lib failed"
|
||||||
|
when: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue