Skip to content

Commit d482aa7

Browse files
author
Neelanjan Manna
authored
chore: Fix experiments charts for 3.0.0 (#613)
* adds metadata.annotation in chaosengine and replaces install-chaos-faults step to use artifacts.data.raw manifests Signed-off-by: neelanjan00 <[email protected]> * fixes annotation -> annotations Signed-off-by: neelanjan00 <[email protected]> * updates labels Signed-off-by: neelanjan00 <[email protected]> --------- Signed-off-by: neelanjan00 <[email protected]>
1 parent c7f3d26 commit d482aa7

File tree

20 files changed

+3481
-105
lines changed

20 files changed

+3481
-105
lines changed

experiments/bank-of-anthos/experiment.yaml

Lines changed: 160 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,168 @@ spec:
3737
args: ["-namespace=bank","-typeName=resilient","-operation=apply","-timeout=400", "-app=bank-of-anthos","-scope=cluster"] #for weak provide type flagName as resilient(-typeName=weak)
3838

3939
- name: install-chaos-faults
40+
inputs:
41+
artifacts:
42+
- name: pod-network-loss-x1w
43+
path: /tmp/pod-network-loss-x1w.yaml
44+
raw:
45+
data: |
46+
apiVersion: litmuschaos.io/v1alpha1
47+
description:
48+
message: |
49+
Injects network packet loss on pods belonging to an app deployment
50+
kind: ChaosExperiment
51+
metadata:
52+
name: pod-network-loss
53+
labels:
54+
name: pod-network-loss
55+
app.kubernetes.io/part-of: litmus
56+
app.kubernetes.io/component: chaosexperiment
57+
app.kubernetes.io/version: latest
58+
spec:
59+
definition:
60+
scope: Namespaced
61+
permissions:
62+
# Create and monitor the experiment & helper pods
63+
- apiGroups: [""]
64+
resources: ["pods"]
65+
verbs:
66+
[
67+
"create",
68+
"delete",
69+
"get",
70+
"list",
71+
"patch",
72+
"update",
73+
"deletecollection",
74+
]
75+
# Performs CRUD operations on the events inside chaosengine and chaosresult
76+
- apiGroups: [""]
77+
resources: ["events"]
78+
verbs: ["create", "get", "list", "patch", "update"]
79+
# Fetch configmaps details and mount it to the experiment pod (if specified)
80+
- apiGroups: [""]
81+
resources: ["configmaps"]
82+
verbs: ["get", "list"]
83+
# Track and get the runner, experiment, and helper pods log
84+
- apiGroups: [""]
85+
resources: ["pods/log"]
86+
verbs: ["get", "list", "watch"]
87+
# for creating and managing to execute commands inside target container
88+
- apiGroups: [""]
89+
resources: ["pods/exec"]
90+
verbs: ["get", "list", "create"]
91+
# deriving the parent/owner details of the pod(if parent is anyof {deployment, statefulset, daemonsets})
92+
- apiGroups: ["apps"]
93+
resources: ["deployments", "statefulsets", "replicasets", "daemonsets"]
94+
verbs: ["list", "get"]
95+
# deriving the parent/owner details of the pod(if parent is deploymentConfig)
96+
- apiGroups: ["apps.openshift.io"]
97+
resources: ["deploymentconfigs"]
98+
verbs: ["list", "get"]
99+
# deriving the parent/owner details of the pod(if parent is deploymentConfig)
100+
- apiGroups: [""]
101+
resources: ["replicationcontrollers"]
102+
verbs: ["get", "list"]
103+
# deriving the parent/owner details of the pod(if parent is argo-rollouts)
104+
- apiGroups: ["argoproj.io"]
105+
resources: ["rollouts"]
106+
verbs: ["list", "get"]
107+
# for configuring and monitor the experiment job by the chaos-runner pod
108+
- apiGroups: ["batch"]
109+
resources: ["jobs"]
110+
verbs: ["create", "list", "get", "delete", "deletecollection"]
111+
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
112+
- apiGroups: ["litmuschaos.io"]
113+
resources: ["chaosengines", "chaosexperiments", "chaosresults"]
114+
verbs: ["create", "list", "get", "patch", "update", "delete"]
115+
image: "litmuschaos/go-runner:latest"
116+
imagePullPolicy: Always
117+
args:
118+
- -c
119+
- ./experiments -name pod-network-loss
120+
command:
121+
- /bin/bash
122+
env:
123+
- name: TARGET_CONTAINER
124+
value: ""
125+
126+
# provide lib image
127+
- name: LIB_IMAGE
128+
value: "litmuschaos/go-runner:latest"
129+
130+
- name: NETWORK_INTERFACE
131+
value: "eth0"
132+
133+
- name: TC_IMAGE
134+
value: "gaiadocker/iproute2"
135+
136+
- name: NETWORK_PACKET_LOSS_PERCENTAGE
137+
value: "100" #in PERCENTAGE
138+
139+
- name: TOTAL_CHAOS_DURATION
140+
value: "60" # in seconds
141+
142+
# time period to wait before and after injection of chaos in sec
143+
- name: RAMP_TIME
144+
value: ""
145+
146+
## percentage of total pods to target
147+
- name: PODS_AFFECTED_PERC
148+
value: ""
149+
150+
- name: DEFAULT_HEALTH_CHECK
151+
value: "false"
152+
153+
- name: TARGET_PODS
154+
value: ""
155+
156+
# To select pods on specific node(s)
157+
- name: NODE_LABEL
158+
value: ""
159+
160+
# provide the name of container runtime
161+
# for litmus LIB, it supports docker, containerd, crio
162+
# for pumba LIB, it supports docker only
163+
- name: CONTAINER_RUNTIME
164+
value: "containerd"
165+
166+
# provide the destination ips
167+
# chaos injection will be triggered for these destination ips
168+
- name: DESTINATION_IPS
169+
value: ""
170+
171+
# provide the destination hosts
172+
# chaos injection will be triggered for these destination hosts
173+
- name: DESTINATION_HOSTS
174+
value: ""
175+
176+
# provide the socket file path
177+
- name: SOCKET_PATH
178+
value: "/run/containerd/containerd.sock"
179+
180+
## it defines the sequence of chaos execution for multiple target pods
181+
## supported values: serial, parallel
182+
- name: SEQUENCE
183+
value: "parallel"
184+
185+
labels:
186+
name: pod-network-loss
187+
app.kubernetes.io/part-of: litmus
188+
app.kubernetes.io/component: experiment-job
189+
app.kubernetes.io/runtime-api-usage: "true"
190+
app.kubernetes.io/version: latest
191+
outputs: {}
192+
metadata: {}
40193
container:
194+
name: ""
41195
image: litmuschaos/k8s:latest
42-
command: [sh, -c]
196+
command:
197+
- sh
198+
- "-c"
43199
args:
44-
- "kubectl apply -f https://hub.litmuschaos.io/api/chaos/master?file=faults/kubernetes/experiments.yaml -n
45-
{{workflow.parameters.adminModeNamespace}} ; sleep 30"
200+
- kubectl apply -f /tmp/pod-network-loss-x1w.yaml -n {{workflow.parameters.adminModeNamespace}} && sleep 30
201+
resources: {}
46202

47203
- name: pod-network-loss
48204
inputs:
@@ -58,6 +214,7 @@ spec:
58214
namespace: {{workflow.parameters.adminModeNamespace}}
59215
labels:
60216
context: "{{workflow.parameters.appNamespace}}_bank-of-anthos"
217+
annotations: {}
61218
spec:
62219
appinfo:
63220
appns: 'bank'

experiments/bank-of-anthos/experiment_cron.yaml

Lines changed: 169 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,169 @@ spec:
4141
args: ["-namespace=bank","-typeName=resilient","-operation=apply","-timeout=400", "-app=bank-of-anthos","-scope=cluster"] #for weak provide type flagName as resilient(-typeName=weak)
4242

4343
- name: install-chaos-faults
44+
inputs:
45+
artifacts:
46+
- name: pod-network-loss-x1w
47+
path: /tmp/pod-network-loss-x1w.yaml
48+
raw:
49+
data: |
50+
apiVersion: litmuschaos.io/v1alpha1
51+
description:
52+
message: |
53+
Injects network packet loss on pods belonging to an app deployment
54+
kind: ChaosExperiment
55+
metadata:
56+
name: pod-network-loss
57+
labels:
58+
name: pod-network-loss
59+
app.kubernetes.io/part-of: litmus
60+
app.kubernetes.io/component: chaosexperiment
61+
app.kubernetes.io/version: latest
62+
spec:
63+
definition:
64+
scope: Namespaced
65+
permissions:
66+
# Create and monitor the experiment & helper pods
67+
- apiGroups: [""]
68+
resources: ["pods"]
69+
verbs:
70+
[
71+
"create",
72+
"delete",
73+
"get",
74+
"list",
75+
"patch",
76+
"update",
77+
"deletecollection",
78+
]
79+
# Performs CRUD operations on the events inside chaosengine and chaosresult
80+
- apiGroups: [""]
81+
resources: ["events"]
82+
verbs: ["create", "get", "list", "patch", "update"]
83+
# Fetch configmaps details and mount it to the experiment pod (if specified)
84+
- apiGroups: [""]
85+
resources: ["configmaps"]
86+
verbs: ["get", "list"]
87+
# Track and get the runner, experiment, and helper pods log
88+
- apiGroups: [""]
89+
resources: ["pods/log"]
90+
verbs: ["get", "list", "watch"]
91+
# for creating and managing to execute commands inside target container
92+
- apiGroups: [""]
93+
resources: ["pods/exec"]
94+
verbs: ["get", "list", "create"]
95+
# deriving the parent/owner details of the pod(if parent is anyof {deployment, statefulset, daemonsets})
96+
- apiGroups: ["apps"]
97+
resources: ["deployments", "statefulsets", "replicasets", "daemonsets"]
98+
verbs: ["list", "get"]
99+
# deriving the parent/owner details of the pod(if parent is deploymentConfig)
100+
- apiGroups: ["apps.openshift.io"]
101+
resources: ["deploymentconfigs"]
102+
verbs: ["list", "get"]
103+
# deriving the parent/owner details of the pod(if parent is deploymentConfig)
104+
- apiGroups: [""]
105+
resources: ["replicationcontrollers"]
106+
verbs: ["get", "list"]
107+
# deriving the parent/owner details of the pod(if parent is argo-rollouts)
108+
- apiGroups: ["argoproj.io"]
109+
resources: ["rollouts"]
110+
verbs: ["list", "get"]
111+
# for configuring and monitor the experiment job by the chaos-runner pod
112+
- apiGroups: ["batch"]
113+
resources: ["jobs"]
114+
verbs: ["create", "list", "get", "delete", "deletecollection"]
115+
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
116+
- apiGroups: ["litmuschaos.io"]
117+
resources: ["chaosengines", "chaosexperiments", "chaosresults"]
118+
verbs: ["create", "list", "get", "patch", "update", "delete"]
119+
image: "litmuschaos/go-runner:latest"
120+
imagePullPolicy: Always
121+
args:
122+
- -c
123+
- ./experiments -name pod-network-loss
124+
command:
125+
- /bin/bash
126+
env:
127+
- name: TARGET_CONTAINER
128+
value: ""
129+
130+
# provide lib image
131+
- name: LIB_IMAGE
132+
value: "litmuschaos/go-runner:latest"
133+
134+
- name: NETWORK_INTERFACE
135+
value: "eth0"
136+
137+
- name: TC_IMAGE
138+
value: "gaiadocker/iproute2"
139+
140+
- name: NETWORK_PACKET_LOSS_PERCENTAGE
141+
value: "100" #in PERCENTAGE
142+
143+
- name: TOTAL_CHAOS_DURATION
144+
value: "60" # in seconds
145+
146+
# time period to wait before and after injection of chaos in sec
147+
- name: RAMP_TIME
148+
value: ""
149+
150+
## percentage of total pods to target
151+
- name: PODS_AFFECTED_PERC
152+
value: ""
153+
154+
- name: DEFAULT_HEALTH_CHECK
155+
value: "false"
156+
157+
- name: TARGET_PODS
158+
value: ""
159+
160+
# To select pods on specific node(s)
161+
- name: NODE_LABEL
162+
value: ""
163+
164+
# provide the name of container runtime
165+
# for litmus LIB, it supports docker, containerd, crio
166+
# for pumba LIB, it supports docker only
167+
- name: CONTAINER_RUNTIME
168+
value: "containerd"
169+
170+
# provide the destination ips
171+
# chaos injection will be triggered for these destination ips
172+
- name: DESTINATION_IPS
173+
value: ""
174+
175+
# provide the destination hosts
176+
# chaos injection will be triggered for these destination hosts
177+
- name: DESTINATION_HOSTS
178+
value: ""
179+
180+
# provide the socket file path
181+
- name: SOCKET_PATH
182+
value: "/run/containerd/containerd.sock"
183+
184+
## it defines the sequence of chaos execution for multiple target pods
185+
## supported values: serial, parallel
186+
- name: SEQUENCE
187+
value: "parallel"
188+
189+
labels:
190+
name: pod-network-loss
191+
app.kubernetes.io/part-of: litmus
192+
app.kubernetes.io/component: experiment-job
193+
app.kubernetes.io/runtime-api-usage: "true"
194+
app.kubernetes.io/version: latest
195+
outputs: {}
196+
metadata: {}
44197
container:
198+
name: ""
45199
image: litmuschaos/k8s:latest
46-
command: [sh, -c]
200+
command:
201+
- sh
202+
- "-c"
47203
args:
48-
- "kubectl apply -f https://hub.litmuschaos.io/api/chaos/master?file=faults/kubernetes/experiments.yaml -n
49-
{{workflow.parameters.adminModeNamespace}} ; sleep 30"
50-
204+
- kubectl apply -f /tmp/pod-network-loss-x1w.yaml -n {{workflow.parameters.adminModeNamespace}} && sleep 30
205+
resources: {}
206+
51207
- name: pod-network-loss
52208
inputs:
53209
artifacts:
@@ -62,6 +218,7 @@ spec:
62218
namespace: {{workflow.parameters.adminModeNamespace}}
63219
labels:
64220
context: "{{workflow.parameters.appNamespace}}_bank-of-anthos"
221+
annotations: {}
65222
spec:
66223
appinfo:
67224
appns: 'bank'
@@ -94,29 +251,29 @@ spec:
94251
components:
95252
env:
96253
- name: TOTAL_CHAOS_DURATION
97-
value: '60'
254+
value: '60'
98255
- name: NETWORK_INTERFACE
99256
value: 'eth0'
100257
- name: NETWORK_PACKET_LOSS_PERCENTAGE
101258
value: '100'
102259
- name: CONTAINER_RUNTIME
103-
value: 'containerd'
260+
value: 'containerd'
104261
- name: SOCKET_PATH
105-
value: '/run/containerd/containerd.sock'
262+
value: '/run/containerd/containerd.sock'
106263
container:
107264
image: litmuschaos/litmus-checker:latest
108-
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
265+
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
109266

110267
- name: delete-application
111268
container:
112269
image: litmuschaos/litmus-app-deployer:latest
113-
args: ["-namespace=bank","-typeName=resilient","-operation=delete", "-app=bank-of-anthos"]
114-
270+
args: ["-namespace=bank","-typeName=resilient","-operation=delete", "-app=bank-of-anthos"]
271+
115272
- name: cleanup-chaos-resources
116273
container:
117274
image: litmuschaos/k8s:latest
118275
command: [sh, -c]
119-
args:
120-
[
276+
args:
277+
[
121278
"kubectl delete chaosengine pod-network-loss-chaos -n {{workflow.parameters.adminModeNamespace}}",
122279
]

0 commit comments

Comments
 (0)