-
Notifications
You must be signed in to change notification settings - Fork 711
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat): Adding openebs control plane pod delete experiment (#1203)
Signed-off-by: Raj <raj.das@mayadata.io>
- Loading branch information
Showing
7 changed files
with
185 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
- block: | ||
|
||
- name: Get a list of all pods from given namespace | ||
k8s_facts: | ||
kind: Pod | ||
|
5 changes: 5 additions & 0 deletions
5
experiments/openebs/openebs-control-plane-pod-delete/chaosutil.j2
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,5 @@ | ||
{% if c_lib is defined and c_lib == 'powerfulseal' %} | ||
c_util: /chaoslib/powerfulseal/pod_failure_by_powerfulseal.yml | ||
{% else %} | ||
c_util: /chaoslib/litmus/kill_random_pod.yml | ||
{% endif %} |
59 changes: 59 additions & 0 deletions
59
...enebs/openebs-control-plane-pod-delete/openebs_control_plane_pod_delete_ansible_logic.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,59 @@ | ||
- hosts: localhost | ||
connection: local | ||
|
||
vars: | ||
c_experiment: "openebs-control-plane-pod-delete" | ||
c_duration: "{{ lookup('env','TOTAL_CHAOS_DURATION') }}" | ||
c_interval: "{{ lookup('env','CHAOS_INTERVAL') }}" | ||
ramp_time: "{{ lookup('env','RAMP_TIME') }}" | ||
c_force: "{{ lookup('env','FORCE') }}" | ||
c_lib: "{{ lookup('env','LIB') }}" | ||
c_svc_acc: "{{ lookup('env','CHAOS_SERVICE_ACCOUNT') }}" | ||
openebs_ns: "{{ lookup('env','OPENEBS_NAMESPACE') }}" | ||
kill_count: "{{ lookup('env','KILL_COUNT') }}" | ||
|
||
tasks: | ||
- block: | ||
- include: openebs_control_plane_pod_delete_ansible_prerequisites.yml | ||
|
||
- include_vars: | ||
file: chaosutil.yml | ||
|
||
- name: Include openebs control plane components | ||
include_vars: | ||
file: /experiments/openebs/openebs_control_plane_components.yml | ||
name: openebs | ||
|
||
## GENERATE EXP RESULT NAME | ||
- block: | ||
|
||
- name: Construct chaos result name (experiment_name) | ||
set_fact: | ||
c_experiment: "{{ lookup('env','CHAOSENGINE') }}-{{ c_experiment }}" | ||
|
||
when: lookup('env','CHAOSENGINE') | ||
|
||
## RECORD START-OF-EXPERIMENT IN LITMUSCHAOS RESULT CR | ||
- include_tasks: /utils/runtime/update_chaos_result_resource.yml | ||
vars: | ||
status: 'SOT' | ||
namespace: "{{ openebs_ns }}" | ||
|
||
## INJECT CHAOS ON CONTROL PLANE COMPONENTS | ||
- name: Including main components | ||
include_tasks: openebs_control_plane_pod_delete_internal_tasks.yml | ||
loop: "{{ openebs.components }}" | ||
|
||
- set_fact: | ||
flag: "Pass" | ||
|
||
rescue: | ||
- set_fact: | ||
flag: "Fail" | ||
|
||
always: | ||
## RECORD END-OF-TEST IN LITMUSCHAOS RESULT CR | ||
- include_tasks: /utils/runtime/update_chaos_result_resource.yml | ||
vars: | ||
status: 'EOT' | ||
namespace: "{{ openebs_ns }}" |
4 changes: 4 additions & 0 deletions
4
...enebs-control-plane-pod-delete/openebs_control_plane_pod_delete_ansible_prerequisites.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,4 @@ | ||
- name: Identify the chaos util to be invoked | ||
template: | ||
src: chaosutil.j2 | ||
dest: chaosutil.yml |
24 changes: 24 additions & 0 deletions
24
...nebs/openebs-control-plane-pod-delete/openebs_control_plane_pod_delete_internal_tasks.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,24 @@ | ||
## PRE-CHAOS APPLICATION LIVENESS CHECK | ||
- name: Verify that the AUT (Application Under Test) is running | ||
include_tasks: "/utils/common/status_app_pod.yml" | ||
vars: | ||
app_ns: "{{ item.namespace }}" | ||
app_label: "{{ item.labels[0] }}" | ||
delay: 1 | ||
retries: 60 | ||
|
||
## FAULT INJECTION | ||
- include_tasks: "{{ c_util }}" | ||
vars: | ||
app_ns: "{{ item.namespace }}" | ||
app_label: "{{ item.labels[0] }}" | ||
c_interval: 5 | ||
|
||
## POST-CHAOS APPLICATION LIVENESS CHECK | ||
- name: Verify AUT liveness post fault-injection | ||
include_tasks: "/utils/common/status_app_pod.yml" | ||
vars: | ||
app_ns: "{{ item.namespace }}" | ||
app_label: "{{ item.labels[0] }}" | ||
delay: 1 | ||
retries: 60 |
49 changes: 49 additions & 0 deletions
49
...nts/openebs/openebs-control-plane-pod-delete/openebs_control_plane_pod_delete_k8s_job.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,49 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
generateName: openebs-control-plane-pod-delete- | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
experiment: openebs-control-plane-pod-delete | ||
spec: | ||
# Placeholder that is updated by the executor for automated runs | ||
# Provide appropriate SA (with desired permissions) if executed manually | ||
serviceAccountName: %CHAOS_SERVICE_ACCOUNT% | ||
restartPolicy: Never | ||
containers: | ||
- name: ansibletest | ||
image: litmuschaos/ansible-runner:ci | ||
imagePullPolicy: Always | ||
env: | ||
- name: ANSIBLE_STDOUT_CALLBACK | ||
value: 'default' | ||
|
||
# provide openebs namespace | ||
- name: OPENEBS_NAMESPACE | ||
value: 'openebs' | ||
|
||
## Period to wait before injection of chaos | ||
- name: RAMP_TIME | ||
value: '6' | ||
|
||
- name: FORCE | ||
value: '' | ||
|
||
## env var that describes the library used to execute the chaos | ||
## default: litmus. Supported values: litmus, powerfulseal | ||
- name: LIB | ||
value: '' | ||
|
||
- name: CHAOSENGINE | ||
value: '' | ||
|
||
- name: CHAOS_SERVICE_ACCOUNT | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.serviceAccountName | ||
|
||
command: ["/bin/bash"] | ||
args: ["-c", "ansible-playbook ./experiments/openebs/openebs-control-plane-pod-delete/openebs_control_plane_pod_delete_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0"] |
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,43 @@ | ||
version: 1.6.0 | ||
components: | ||
- name: maya-apiserver | ||
kind: Deployment | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=maya-apiserver | ||
|
||
- name: openebs-admission-server | ||
kind: Deployment | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=admission-webhook | ||
|
||
- name: openebs-localpv-provisioner | ||
kind: Deployment | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=openebs-localpv-provisioner | ||
|
||
- name: openebs-ndm-operator | ||
kind: Deployment | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=ndm-operator | ||
|
||
- name: openebs-provisioner | ||
kind: Deployment | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=openebs-provisioner | ||
|
||
- name: openebs-snapshot-operator | ||
kind: Deployment | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=openebs-snapshot-operator | ||
|
||
- name: openebs-ndm | ||
kind: DaemonSet | ||
namespace: openebs | ||
labels: | ||
- openebs.io/component-name=ndm |