forked from litmuschaos/chaos-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiment.yaml
150 lines (141 loc) · 4.91 KB
/
experiment.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: argowf-chaos-node-memory-hog
namespace: litmus
labels:
subject: "{{workflow.parameters.context}}"
spec:
entrypoint: argowf-chaos
serviceAccountName: argo-chaos
securityContext:
runAsUser: 1000
runAsNonRoot: true
arguments:
parameters:
- name: adminModeNamespace
value: "litmus"
- name: context
value: "node-memory-hog_infra"
templates:
- name: argowf-chaos
steps:
- - name: install-chaos-faults
template: install-chaos-faults
- - name: run-chaos
template: run-chaos
- - name: cleanup-chaos-resources
template: cleanup-chaos-resources
- name: install-chaos-faults
inputs:
artifacts:
- name: install-chaos-faults
path: /tmp/node-memory-hog.yaml
raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Give a memory hog on a node belonging to a deployment
kind: ChaosExperiment
metadata:
name: node-memory-hog
spec:
definition:
scope: Cluster
permissions:
- apiGroups:
- ""
- "batch"
- "apps"
- "litmuschaos.io"
resources:
- "jobs"
- "pods"
- "pods/log"
- "events"
- "chaosengines"
- "chaosexperiments"
- "chaosresults"
verbs:
- "create"
- "list"
- "get"
- "patch"
- "update"
- "delete"
- apiGroups:
- ""
resources:
- "nodes"
verbs:
- "get"
- "list"
image: "litmuschaos.docker.scarf.sh/litmuschaos/go-runner:3.11.0"
imagePullPolicy: Always
args:
- -c
- ./experiments -name node-memory-hog
command:
- /bin/bash
env:
- name: TOTAL_CHAOS_DURATION
value: '120'
## specify the size as percent of total available memory (in percentage)
## Default value "90"
- name: MEMORY_PERCENTAGE
value: '90'
# Period to wait before and after injection of chaos in sec
- name: RAMP_TIME
value: ''
# provide lib image
- name: LIB_IMAGE
value: 'litmuschaos.docker.scarf.sh/litmuschaos/go-runner:3.11.0'
labels:
name: node-memory-hog
container:
image: litmuschaos/k8s:latest
command: [sh, -c]
args:
[
"kubectl apply -f /tmp/node-memory-hog.yaml -n {{workflow.parameters.adminModeNamespace}}",
]
- name: run-chaos
inputs:
artifacts:
- name: run-chaos
path: /tmp/chaosengine.yaml
raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: kube-proxy-node-memory-hog-chaos
namespace: "{{workflow.parameters.adminModeNamespace}}"
labels:
context: "{{workflow.parameters.context}}"
annotations: {}
spec:
jobCleanUpPolicy: retain
engineState: 'active'
chaosServiceAccount: litmus-admin
experiments:
- name: node-memory-hog
spec:
components:
env:
- name: MEMORY_PERCENTAGE
value: '50'
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds
container:
image: litmuschaos/litmus-checker:latest
args: ["-file=/tmp/chaosengine.yaml", "-saveName=/tmp/engine-name"]
- name: cleanup-chaos-resources
container:
image: litmuschaos/k8s:latest
command: [sh, -c]
args:
[
"kubectl delete chaosengine kube-proxy-node-memory-hog-chaos -n {{workflow.parameters.adminModeNamespace}}",
]