-
Notifications
You must be signed in to change notification settings - Fork 28
/
demo.yaml
174 lines (174 loc) · 4.75 KB
/
demo.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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache License Version 2.0.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2024 Datadog, Inc.
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: demo
namespace: chaos-demo
spec:
# not specifying storage class aims to rely on default storage class instead
# this intent to avoid forcing people to install longhorn by default if they do not aim to test disk throttling capabilities
# longhorn storage provider being a significant payload for a local setup
# storageClassName: longhorn
# this will require to delete the PVC/PV and re-create them if longhorn is installed afterwards though
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-nginx
namespace: chaos-demo
labels:
app: demo-nginx
spec:
replicas: 1
selector:
matchLabels:
app: demo-nginx
template:
metadata:
labels:
app: demo-nginx
spec:
containers:
- name: nginx
image: nginx:1.27
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 3
periodSeconds: 3
readinessProbe:
httpGet:
path: /
port: 80
resources:
limits:
memory: 32Mi
cpu: 10m
requests:
memory: 32Mi
cpu: 10m
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: demo-curl
namespace: chaos-demo
labels:
app: demo-curl
spec:
replicas: 1
selector:
matchLabels:
app: demo-curl
template:
metadata:
annotations:
app.kubernetes.io/component: client
labels:
app: demo-curl
# chaos.datadoghq.com/disrupt-on-init: "true" # uncomment this and run `kubectl -n chaos-demo apply -f examples/demo.yaml`, for testing the examples/on_init.yaml disruption
spec:
containers:
- name: cpu-stress # jump into pod and run `kill -s TERM 7` to confirm re-start apply cpu reinjection
image: alpine/curl:8.9.1
command: [/bin/sh, -c]
args:
- ee(){exit 1}; trap 'ee' TERM; tail -f /dev/null
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 32Mi
cpu: 1500m
requests:
memory: 32Mi
cpu: 1500m
- name: curl
image: alpine/curl:8.9.1
command: [/bin/sh]
args:
- -c
- while true; do time curl -vvv --connect-timeout 15 http://demo.chaos-demo.svc.cluster.local:8080; sleep 1; done
resources:
limits:
memory: 32Mi
cpu: 10m
requests:
memory: 32Mi
cpu: 10m
- name: curl-remote
image: alpine/curl:8.9.1
command: [/bin/sh]
args:
- -c
- while true; do time curl --connect-timeout 15 -vvv https://www.example.com; sleep 1; done
resources:
limits:
memory: 32Mi
cpu: 10m
requests:
memory: 32Mi
cpu: 10m
- name: read-file
image: ubuntu:focal-20240918
command: ["/bin/bash"]
args:
- -c
- "echo 'create file to read from: /mnt/data/disk-read-file' && dd if=/dev/zero of=/mnt/data/disk-read-file bs=10k count=1; while true; do time dd if=/mnt/data/disk-read-file of=/dev/null iflag=direct; sleep 1; done"
volumeMounts:
- mountPath: /mnt/data
name: data
resources:
limits:
memory: 32Mi
cpu: 100m
requests:
memory: 32Mi
cpu: 100m
- name: write-file
image: ubuntu:focal-20240918
command: ["/bin/bash"]
args:
- -c
- while true; do time dd if=/dev/zero of=/mnt/data/disk-write-file bs=10k count=1 oflag=direct; sleep 1; done
volumeMounts:
- mountPath: /mnt/data
name: data
resources:
limits:
memory: 32Mi
cpu: 100m
requests:
memory: 32Mi
cpu: 100m
volumes:
- name: data
persistentVolumeClaim:
claimName: demo
---
apiVersion: v1
kind: Service
metadata:
name: demo
namespace: chaos-demo
spec:
ports:
- name: regular-port
port: 8080
targetPort: 80
protocol: TCP
- name: other
port: 8081
targetPort: 80
protocol: TCP
selector:
app: demo-nginx