Skip to content

Commit 90dfbea

Browse files
ispeakc0deksatchit
authored andcommitted
(refactor): Updating kafka broker pod failure experiment (#1095)
Signed-off-by: shubhamchaudhary <[email protected]>
1 parent 7b3e8cb commit 90dfbea

File tree

7 files changed

+25
-31
lines changed

7 files changed

+25
-31
lines changed

chaoslib/chaoskube/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
## Note
22

3-
The chaoskube library is not supported by litmuschaos any more. It will be left here, because it can be used if the chaosServiceAccount has cluster-scope. As of version 0.8 chaosexperiments are namespace-scoped
3+
The chaoskube library is not supported by litmuschaos any more. It will be left here, because it can be used if the chaosServiceAccount has cluster-scope. As of version 1.0 the pod-delete (and other app-level) chaosexperiments are namespace-scoped

chaoslib/powerfulseal/pod_failure_by_powerfulseal.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77

88
- name: Setup powerfulseal to initiate random pod chaos
99
shell:
10-
kubectl apply -f powerfulseal.yml -n {{ a_ns }}
10+
kubectl apply -f powerfulseal.yml -n {{ app_ns }}
1111
args:
1212
executable: /bin/bash
1313
register: deployment_result
1414
failed_when: "deployment_result.rc != 0"
1515

1616
- name: Confirm that powerfulseal pod is running
1717
shell: >
18-
kubectl get pod -l name=powerfulseal --no-headers -n {{ a_ns }}
18+
kubectl get pod -l name=powerfulseal --no-headers -n {{ app_ns }}
1919
args:
2020
executable: /bin/bash
2121
register: result
@@ -28,7 +28,7 @@
2828

2929
- name: Tear down the powerfulseal deployment
3030
shell:
31-
kubectl delete -f powerfulseal.yml -n {{ a_ns }}
31+
kubectl delete -f powerfulseal.yml -n {{ app_ns }}
3232
args:
3333
executable: /bin/bash
3434
register: result
@@ -50,7 +50,7 @@
5050

5151
- name: Tear down the powerfulseal deployment
5252
shell: >
53-
kubectl delete -f powerfulseal.yml -n {{ a_ns }}
53+
kubectl delete -f powerfulseal.yml -n {{ app_ns }}
5454
args:
5555
executable: /bin/bash
5656
when: deployment_result.rc == 0

chaoslib/powerfulseal/powerfulseal.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ data:
1313
- name: "delete random pods in default namespace"
1414
match:
1515
- labels:
16-
namespace: {{ a_ns }}
17-
selector: {{ a_label }}
16+
namespace: {{ app_ns }}
17+
selector: {{ app_label }}
1818
filters:
1919
- randomSample:
2020
size: 1

executor/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,8 @@
127127
128128
### Limitations
129129
130-
- Executor is currently unable to parse more than one configmap.
131-
132130
- The name of file which contains data for configmap in experimentCR should be parameters.yml
133131
134132
- The configmap is mounted in this default directory: /mnt/
135133
136-
- Executor is currently unable to parse more than one secret.
137-
138134
- The secret is mounted in this default directory: /tmp/

experiments/kafka/kafka-broker-pod-failure/chaosutil.j2

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
{% if c_lib is defined and c_lib == 'chaoskube' %}
2-
c_util: /chaoslib/chaoskube/pod_failure_by_chaoskube.yml
3-
{% elif c_lib is defined and c_lib == 'powerfulseal' %}
1+
{% if c_lib is defined and c_lib == 'powerfulseal' %}
42
c_util: /chaoslib/powerfulseal/pod_failure_by_powerfulseal.yml
53
{% else %}
64
c_util: /chaoslib/litmus/pod_failure_by_litmus.yml

experiments/kafka/kafka-broker-pod-failure/kafka-broker-pod-failure-ansible-logic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
c_interval: "{{ lookup('env','CHAOS_INTERVAL') }}"
99
c_force: "{{ lookup('env','FORCE') }}"
1010
c_lib: "{{ lookup('env','LIB') }}"
11+
c_svc_acc: "{{ lookup('env','CHAOS_SERVICE_ACCOUNT') }}"
1112
kill_count: "{{ lookup('env','KILL_COUNT') }}"
1213
kafka_instance: "{{ lookup('env','KAFKA_INSTANCE_NAME') }}"
1314
kafka_ns: "{{ lookup('env','KAFKA_NAMESPACE') }}"
@@ -67,7 +68,6 @@
6768
vars:
6869
app_ns: "{{ kafka_ns }}"
6970
app_label: "{{ kafka_label }}"
70-
7171
# derived from the 'kafka_broker_util' task
7272
app_pod_name: "{{ kafka_broker }}"
7373

utils/apps/kafka/kafka_cluster_health.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
vars:
1313
delay: 1
1414
retries: 60
15-
a_ns: "{{ zk_ns }}"
16-
a_label: "{{ zk_label }}"
15+
app_ns: "{{ zk_ns }}"
16+
app_label: "{{ zk_label }}"
1717

1818
- name: Obtain pods name of any one of the zookeeper pods
1919
shell: >
@@ -51,19 +51,19 @@
5151

5252
when: "kafka_instance is defined and kafka_instance != ''"
5353

54-
- block:
55-
- name: Derive the available kafka brokers from zookeeper
56-
shell: >
57-
kubectl exec {{ zk_pod_name }} -n {{ zk_ns }} bash
58-
-- zkCli.sh -server {{ zk_service }}:{{ zk_port }}
59-
ls /brokers/ids | tail -n 1 | tr -d '[],' | tr ' ' '\n' | wc -l
60-
args:
61-
executable: /bin/bash
62-
register: kafka_available_brokers
54+
# - block:
55+
# - name: Derive the available kafka brokers from zookeeper
56+
# shell: >
57+
# kubectl exec {{ zk_pod_name }} -n {{ zk_ns }} bash
58+
# -- zkCli.sh -server {{ zk_service }}:{{ zk_port }}
59+
# ls /brokers/ids | tail -n 1 | tr -d '[],' | tr ' ' '\n' | wc -l
60+
# args:
61+
# executable: /bin/bash
62+
# register: kafka_available_brokers
6363

64-
- name: Check whether all kafka brokers are alive
65-
debug:
66-
msg: "All Kafka brokers are alive"
67-
failed_when: "kafka_sts_replicas.stdout != kafka_available_brokers.stdout"
64+
# - name: Check whether all kafka brokers are alive
65+
# debug:
66+
# msg: "All Kafka brokers are alive"
67+
# failed_when: "kafka_sts_replicas.stdout != kafka_available_brokers.stdout"
6868

69-
when: "kafka_instance is not defined or kafka_instance == ''"
69+
# when: "kafka_instance is not defined or kafka_instance == ''"

0 commit comments

Comments
 (0)