feat(experiment) Adding support for generation of events in chaosengine (#1264)

Signed-off-by: shubhamchaudhary <shubham.chaudhary@mayadata.io>
This commit is contained in:
Shubham Chaudhary 2020-03-08 14:05:19 +05:30 committed by GitHub
parent a9a9269265
commit d79d6cd1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 604 additions and 18 deletions

View File

@ -128,6 +128,15 @@
register: container_id
failed_when: container_id is failed
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ app_container }} container of {{ app_pod }} pod"
when: "c_engine is defined and c_engine != ''"
- name: Kill the container
shell: >
kubectl exec {{ chaos_pod.stdout}} -n {{ namespace }} --

View File

@ -4,6 +4,15 @@
wait_for: timeout="{{ ramp_time }}"
when: "ramp_time is defined and ramp_time != ''"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ app_node }} node"
when: "c_engine is defined and c_engine != ''"
- name: Drain the application node
shell: >
kubectl drain {{ app_node }}

View File

@ -80,6 +80,15 @@
vars:
cpu_stress_image: "{{ lib_image }}"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ app_pod }} pod"
when: "c_engine is defined and c_engine != ''"
- name: Setup cpu chaos infrastructure
shell: >
kubectl create -f /chaoslib/litmus/cpu_hog/app_cpu_stress.yml -n {{ app_ns }}

View File

@ -64,6 +64,15 @@
src: /chaoslib/litmus/disk_fill/disk_fill_ds.j2
dest: /chaoslib/litmus/disk_fill/disk_fill_ds.yml
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ pod_name.stdout }}"
when: "c_engine is defined and c_engine != ''"
- name: Create the DaemonSet for Disk-Fill
shell: >
kubectl apply -f /chaoslib/litmus/disk_fill/disk_fill_ds.yml -n {{ a_ns }}

View File

@ -53,6 +53,15 @@
when: "app_pod_name is defined and app_pod_name != ''"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ app_pod }} pod"
when: "c_engine is defined and c_engine != ''"
- debug:
msg: "Killing pod {{ app_pod }}"

View File

@ -2,6 +2,15 @@
wait_for: timeout="{{ ramp_time }}"
when: "ramp_time is defined and ramp_time != ''"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ disk_name }} disk"
when: "c_engine is defined and c_engine != ''"
- name: Detaching the disk
ec2_vol:
id: "{{ disk_name }}"

View File

@ -2,6 +2,15 @@
wait_for: timeout="{{ ramp_time }}"
when: "ramp_time is defined and ramp_time != ''"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ disk_name }} disk"
when: "c_engine is defined and c_engine != ''"
- name: Detaching the disk
shell: gcloud compute instances detach-disk {{ node_name }} --disk {{ disk_name }} --zone {{ zone_name }}

View File

@ -15,6 +15,15 @@
template:
src: /chaoslib/litmus/platform/gke/node-cpu-hog-daemonset.j2
dest: /chaoslib/litmus/platform/gke/node-cpu-hog-daemonset.yml
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ node_name }} node"
when: "c_engine is defined and c_engine != ''"
## CREATING A DAEMONSET FOR CPU-HOG
- name: Creating a DaemonSet for cpu-hog

View File

@ -3,6 +3,15 @@
- name: Wait for the specified ramp time before injecting chaos
wait_for: timeout="{{ ramp_time }}"
when: "ramp_time is defined and ramp_time != ''"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on application pod"
when: "c_engine is defined and c_engine != ''"
- name: Generate the powerfulseal deployment spec from template
template:

View File

@ -69,7 +69,16 @@
dest: /chaoslib/pumba/network_chaos/pumba_kube.yml
vars:
pumba_image: "{{ lib_image }}"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ app_pod }} pod"
when: "c_engine is defined and c_engine != ''"
- name: Setup pumba chaos infrastructure
shell: >
kubectl create -f /chaoslib/pumba/network_chaos/pumba_kube.yml -n {{ a_ns }}

View File

@ -60,6 +60,15 @@
app_pod: "{{ app_pod }}"
app_container: "{{ a_container }}"
## RECORD EVENT FOR CHAOS INJECTION
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "ChaosInject"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Injecting {{ c_experiment }} chaos on {{ a_container }} container of {{ app_pod }} pod"
when: "c_engine is defined and c_engine != ''"
- name: Setup pumba chaos infrastructure
shell: >
kubectl apply -f /chaoslib/pumba/pumba_kube.yml
@ -67,7 +76,7 @@
args:
executable: /bin/bash
register: pumba_job_result
- name: Wait until the pumba sig-kill job is completed
shell: >
kubectl get pods -l job-name=pumba-sig-kill-{{ chaos_uid }} --no-headers -n {{ namespace }}

View File

@ -73,6 +73,15 @@
retries: 90
app_ns: "{{ c_ns }}"
app_label: "run=liveness-app"
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
@ -97,6 +106,15 @@
retries: 90
app_ns: "{{ c_ns }}"
app_label: "run=liveness-app"
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## DEPROVISIONING TASK

View File

@ -44,6 +44,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
@ -60,7 +69,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:
flag: "Pass"

View File

@ -60,6 +60,15 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
@ -74,8 +83,8 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
# Auxiliary application health check status
- block:
@ -90,6 +99,15 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:
flag: "Pass"

View File

@ -67,6 +67,15 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
# Gcloud authentication
- name: Gcloud authentication
include_tasks: "/utils/cloud/gcp/gcloud_configure.yml"
@ -123,6 +132,15 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Disk has been reattached and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## POST-CHAOS DISK LIVENESS CHECK
- name: Verify that the disk is connected to node (post)
include_tasks: "/utils/cloud/gcp/status_disk.yml"

View File

@ -64,6 +64,15 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## READY TO HOG THE NODE CPU
- name: Ready to hog the node cpu
include_tasks: "{{ c_util }}"
@ -124,6 +133,15 @@
when: node_status is defined and node_status.stdout != 'Ready'
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:
flag: "Pass"

View File

@ -77,6 +77,15 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## STORAGE FAULT INJECTION
- include_tasks: /chaoslib/litmus/cordon_drain_node.yml
@ -84,6 +93,8 @@
app_ns: "{{ a_ns }}"
app_node: "{{ a_node }}"
## POST-CHAOS APPLICATION LIVENESS CHECK
- name: Verify AUT liveness post fault-injection
include_tasks: "/utils/common/status_app_pod.yml"
vars:
@ -106,7 +117,14 @@
when: auxiliary_appinfo is defined and auxiliary_appinfo != ''
## POST-CHAOS APPLICATION LIVENESS CHECK
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Node has been uncordoned and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- include_tasks: /utils/common/application_liveness_check.yml
when: liveness_label != ''

View File

@ -47,6 +47,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
vars:
@ -60,7 +69,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:

View File

@ -37,7 +37,7 @@
vars:
status: 'SOT'
namespace: "{{ a_ns }}"
## PRE-CHAOS APPLICATION LIVENESS CHECK
- name: Verify that the AUT (Application Under Test) is running
@ -48,13 +48,22 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
vars:
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
## POST-CHAOS APPLICATION LIVENESS CHECK
- name: Verify AUT liveness post fault-injection
@ -63,7 +72,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:
flag: "Pass"

View File

@ -38,7 +38,7 @@
vars:
status: 'SOT'
namespace: "{{ a_ns }}"
## PRE-CHAOS APPLICATION LIVENESS CHECK
- name: Verify that the AUT (Application Under Test) is running
include_tasks: "/utils/common/status_app_pod.yml"
@ -48,6 +48,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
vars:
@ -60,7 +69,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:

View File

@ -48,6 +48,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
vars:
@ -60,7 +69,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:

View File

@ -48,6 +48,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## FAULT INJECTION
- include_tasks: "{{ c_util }}"
vars:
@ -60,7 +69,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:
flag: "Pass"

View File

@ -66,6 +66,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Derive the kafka-broker node name
shell:
kubectl get pod {{ kafka_broker }} -n {{ kafka_ns }} --no-headers -o custom-columns=:spec.nodeName
@ -120,6 +129,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "Disk has been reattached and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- include_tasks: "/utils/apps/kafka/kafka_liveness_cleanup.yml"
when: kafka_stream is defined and kafka_stream != ''

View File

@ -57,6 +57,16 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## SETUP KAFKA CHAOS INFRA AND DERIVE BROKERS UNDER TEST
- include_tasks: "{{ kafka_broker_util }}"
@ -80,6 +90,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## CHECK FOR KAFKA LIVENESS & CLEANUP
- block:

View File

@ -57,6 +57,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## SETUP KAFKA CHAOS INFRA AND DERIVE BROKERS UNDER TEST
- include_tasks: "{{ kafka_broker_util }}"
@ -80,6 +89,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## CHECK FOR KAFKA LIVENESS & CLEANUP
- block:

View File

@ -58,6 +58,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## SETUP KAFKA CHAOS INFRA AND DERIVE BROKERS UNDER TEST
- include_tasks: "{{ kafka_broker_util }}"
@ -79,6 +88,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## CHECK FOR KAFKA LIVENESS & CLEANUP
- block:

View File

@ -38,11 +38,29 @@
status: 'SOT'
namespace: "{{ openebs_ns }}"
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ openebs_ns }}"
message: "OpenEBS control plane components are Running successfully"
when: "c_engine is defined and c_engine != ''"
## INJECT CHAOS ON CONTROL PLANE COMPONENTS
- name: Including main components
include_tasks: openebs_control_plane_chaos_internal_tasks.yml
loop: "{{ openebs.components }}"
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ openebs_ns }}"
message: "OpenEBS control plane components are Running successfully"
when: "c_engine is defined and c_engine != ''"
- set_fact:
flag: "Pass"

View File

@ -87,6 +87,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT are Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Create some test data
include: "{{ data_consistency_util_path }}"
vars:
@ -109,6 +118,15 @@
app_label: "{{ a_label }}"
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT are Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Verify application data persistence
include: "{{ data_consistency_util_path }}"

View File

@ -67,6 +67,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Get application pod name
shell: >
kubectl get pods -n {{ a_ns }} -l {{ a_label }} --no-headers -o=custom-columns=NAME:".metadata.name"
@ -103,6 +112,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Verify application data persistence
include: "{{ consistencyutil }}"
vars:

View File

@ -66,6 +66,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Get application pod name
shell: >
kubectl get pods -n {{ a_ns }} -l {{ a_label }} --no-headers -o=custom-columns=NAME:".metadata.name"
@ -102,6 +111,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Verify application data persistence
include: "{{ consistencyutil }}"
vars:

View File

@ -90,6 +90,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- block:
- name: Get application pod name
@ -129,6 +138,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- block:
- name: Get application pod name

View File

@ -86,6 +86,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Get application pod name
shell: >
kubectl get pods -n {{ a_ns }} -l {{ a_label }} --no-headers
@ -118,7 +127,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## POST-CHAOS APPLICATION LIVENESS CHECK
- include_tasks: /utils/common/application_liveness_check.yml

View File

@ -83,6 +83,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Get application pod name
shell: >
kubectl get pods -n {{ a_ns }} -l {{ a_label }} --no-headers
@ -112,6 +121,15 @@
app_label: "{{ a_label }}"
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- include_tasks: /utils/common/application_liveness_check.yml
when: liveness_label != ''

View File

@ -83,6 +83,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Get application pod name
shell: >
kubectl get pods -n {{ a_ns }} -l {{ a_label }} --no-headers
@ -112,6 +121,15 @@
app_label: "{{ a_label }}"
delay: 2
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- include_tasks: /utils/common/application_liveness_check.yml
when: liveness_label != ''

View File

@ -82,6 +82,15 @@
delay: 2
retries: 90
## RECORD EVENT FOR PRE-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PreChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
- name: Get application pod name
shell: >
kubectl get pods -n {{ a_ns }} -l {{ a_label }} --no-headers
@ -114,7 +123,16 @@
app_ns: "{{ a_ns }}"
app_label: "{{ a_label }}"
delay: 2
retries: 90
retries: 90
## RECORD EVENT FOR POST-CHAOS CHECK
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "PostChaosCheck"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "OpenEBS components and AUT is Running successfully"
when: "c_engine is defined and c_engine != ''"
## POST-CHAOS APPLICATION LIVENESS CHECK
- include_tasks: /utils/common/application_liveness_check.yml

View File

@ -0,0 +1,35 @@
- name: Obtain the date in ISO8601 format
shell: date --iso-8601=seconds
register: date_from_linux_shell
- set_fact:
ts: "{{ date_from_linux_shell.stdout.split('+')[0] + 'Z'}}"
- name: Create an test event on the chaosengine
k8s:
state: present
definition:
apiVersion: v1
kind: Event
metadata:
# standardize for stages for experiment
name: event-"{{ stage }}"
namespace: "{{ engine_ns }}"
message: "{{ message }}"
# change this as per stage of experiment
reason: "{{ stage }}"
source:
# this needs to be replaced by the exp job/pod name
component: "{{ exp_pod_name }}"
type: Normal
count: 1
firstTimestamp: "{{ ts }}"
involvedObject:
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
# this needs to be replaced by actual chaosengine name
name: "{{ c_engine }}"
# this needs to be replaced by actual resource ns
namespace: "{{ engine_ns }}"
## uid is passed as env from chaos-runner
uid: "{{ chaos_uid }}"

View File

@ -16,12 +16,31 @@
debug:
msg: "failStep: {{ failStep }}"
## RECORD Summary event
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "Summary"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "{{ c_experiment }} Experiment Failed!"
when: "c_engine is defined and c_engine != ''"
when: "flag is defined and flag == 'Fail'"
- block:
- block:
- name: Record the name of failed step
set_fact:
failStep: "N/A"
## RECORD Summary event
- include_tasks: /utils/common/generate-kubernetes-chaos-events.yml
vars:
stage: "Summary"
exp_pod_name: "{{ chaos_pod_name }}"
engine_ns: "{{ a_ns }}"
message: "{{ c_experiment }} Experiment Passed!"
when: "c_engine is defined and c_engine != ''"
when: "flag is defined and flag == 'Pass'"