Skip to content

Commit

Permalink
Merge pull request #1213 from ksatchit/v1.1.x
Browse files Browse the repository at this point in the history
[Cherry-pick for RC2]
  • Loading branch information
Karthik Satchitanand authored Feb 14, 2020
2 parents c43ac26 + f40687b commit 4b45164
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: containerd-chaos
labels:
chaosUID: {{ chaosUID }}
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -30,4 +32,4 @@ spec:
name: cri-socket
- hostPath:
path: /etc/crictl.yml
name: cri-config
name: cri-config
4 changes: 3 additions & 1 deletion chaoslib/litmus/cpu_hog/app_cpu_stress.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: batch/v1
kind: Job
metadata:
name: app-cpu-stress-{{ run_id }}
labels:
chaosUID: {{ chaosUID }}
spec:
template:
metadata:
Expand Down Expand Up @@ -43,4 +45,4 @@ spec:
volumes:
- hostPath:
path: /var/run/docker.sock
name: dockersocket
name: dockersocket
4 changes: 3 additions & 1 deletion chaoslib/litmus/disk_fill/disk_fill_ds.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: disk-fill
labels:
chaosUID: {{ chaosUID }}
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -30,4 +32,4 @@ spec:
volumes:
- name: udev
hostPath:
path: /var/lib/docker/containers
path: /var/lib/docker/containers
75 changes: 38 additions & 37 deletions chaoslib/litmus/kill_random_pod.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,53 @@
- block:

- name: Get a list of all pods from given namespace
k8s_facts:
kind: Pod
namespace: "{{ app_ns }}"
label_selectors:
- "{{ app_label }}"
register: pod_list

- name: Initialize deletion list
set_fact:
target_pod_list: []

- block:

- name: Select a random pod to kill
set_fact:
app_pod_random: "{{ pod_list.resources | random | json_query('metadata.name') }}"

- name: Construct the deletion list with single random pod
set_fact:
target_pod_list: "{{ target_pod_list + [app_pod_random] }}"
- name: Get a list of all pods from given namespace
k8s_facts:
kind: Pod
namespace: "{{ app_ns }}"
label_selectors:
- "{{ app_label }}"
register: pod_list

- name: Initialize deletion list
set_fact:
target_pod_list: []

- block:

- name: Select a random pod to kill
set_fact:
app_pod_random: "{{ pod_list.resources | random | json_query('metadata.name') }}"

- name: Construct the deletion list with single random pod
set_fact:
target_pod_list: "{{ target_pod_list + [app_pod_random] }}"

- set_fact:
app_pod: "{{ target_pod_list | join(' ') }}"
- set_fact:
app_pod: "{{ target_pod_list | join(' ') }}"

when: "kill_count is not defined or kill_count == ''"
when: "kill_count is not defined or kill_count == ''"

- block:
- block:

- name: Add elements into target pod group list
set_fact:
target_pod_list: "{{ target_pod_list + [resource | json_query('metadata.name')] }}"
loop: "{{ pod_list.resources }}"
loop_control:
loop_var: resource
- name: Add elements into target pod group list
set_fact:
target_pod_list: "{{ target_pod_list + [resource | json_query('metadata.name')] }}"
loop: "{{ pod_list.resources }}"
loop_control:
loop_var: resource

- set_fact:
app_pod: "{{ target_pod_list[0:(kill_count|int)] | join(' ') }}"
- set_fact:
app_pod: "{{ target_pod_list[0:(kill_count|int)] | join(' ') }}"

when: "kill_count is defined and kill_count != ''"
when: "kill_count is defined and kill_count != ''"

when: "app_pod_name is not defined or app_pod_name == ''"

- block:
- name: Record app pod
set_fact:
app_pod: "{{ app_pod_name }}"

- name: Record app pod
set_fact:
app_pod: "{{ app_pod_name }}"

when: "app_pod_name is defined and app_pod_name != ''"

Expand Down
4 changes: 3 additions & 1 deletion chaoslib/litmus/platform/gke/node-cpu-hog-daemonset.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: node-cpu-hog
labels:
chaosUID: {{ chaosUID }}
spec:
selector:
matchLabels:
Expand All @@ -19,4 +21,4 @@ spec:
imagePullPolicy: Always
name: cpu-hog
command: ["/bin/bash"]
args: ["-c", "sleep 10000"]
args: ["-c", "sleep 10000"]
4 changes: 3 additions & 1 deletion chaoslib/powerfulseal/powerfulseal.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: powerfulseal
labels:
chaosUID: {{ chaosUID }}
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -57,4 +59,4 @@ spec:
volumes:
- name: policyfile
configMap:
name: policy
name: policy
4 changes: 3 additions & 1 deletion chaoslib/pumba/network_chaos/pumba_netem_job.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: batch/v1
kind: Job
metadata:
name: pumba-netem-{{ run_id }}
labels:
chaosUID: {{ chaosUID }}
spec:
template:
metadata:
Expand Down Expand Up @@ -52,4 +54,4 @@ spec:
volumes:
- hostPath:
path: /var/run/docker.sock
name: dockersocket
name: dockersocket
4 changes: 3 additions & 1 deletion chaoslib/pumba/pumba.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: pumba
labels:
chaosUID: {{ chaosUID }}
spec:
selector:
matchLabels:
Expand Down Expand Up @@ -36,4 +38,4 @@ spec:
volumes:
- hostPath:
path: /var/run/docker.sock
name: dockersocket
name: dockersocket
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
connection: local

vars:
c_experiment: "openebs-control-plane-pod-delete"
c_experiment: "openebs-control-plane-validation"
c_duration: "{{ lookup('env','TOTAL_CHAOS_DURATION') }}"
c_interval: "{{ lookup('env','CHAOS_INTERVAL') }}"
ramp_time: "{{ lookup('env','RAMP_TIME') }}"
Expand All @@ -14,7 +14,7 @@

tasks:
- block:
- include: openebs_control_plane_pod_delete_ansible_prerequisites.yml
- include: openebs_control_plane_validation_ansible_prerequisites.yml

- include_vars:
file: chaosutil.yml
Expand All @@ -41,7 +41,7 @@

## INJECT CHAOS ON CONTROL PLANE COMPONENTS
- name: Including main components
include_tasks: openebs_control_plane_pod_delete_internal_tasks.yml
include_tasks: openebs_control_plane_validation_internal_tasks.yml
loop: "{{ openebs.components }}"

- set_fact:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
apiVersion: batch/v1
kind: Job
metadata:
generateName: openebs-control-plane-pod-delete-
generateName: openebs-control-plane-validation-
spec:
template:
metadata:
labels:
experiment: openebs-control-plane-pod-delete
experiment: openebs-control-plane-validation
spec:
# Placeholder that is updated by the executor for automated runs
# Provide appropriate SA (with desired permissions) if executed manually
Expand Down Expand Up @@ -46,4 +46,4 @@ spec:
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"]
args: ["-c", "ansible-playbook ./experiments/openebs/openebs-control-plane-validation/openebs_control_plane_validation_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0"]
5 changes: 5 additions & 0 deletions experiments/openebs/openebs-pool-pod-failure/chaosutil.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if a_pvc is defined and a_pvc != '' %}
c_util: /experiments/openebs/openebs-pool-pod-failure/cstor_pool_delete.yml
{% else %}
c_util: /chaoslib/litmus/kill_random_pod.yml
{% endif %}
Loading

0 comments on commit 4b45164

Please sign in to comment.