Skip to content

Commit 92b4cbc

Browse files
committed
Added first draft of chaos engineering chapter
Signed-off-by: Russ Miles <[email protected]>
1 parent 58fd648 commit 92b4cbc

File tree

7 files changed

+568
-2
lines changed

7 files changed

+568
-2
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
**/target
44
**/.idea
55
**/dependency-reduced-pom.xml
6-
6+
**/journal.json
7+
**/chaostoolkit.log

03-path-application-development/308-cicd-workflows/readme.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ Once you've looked at the options above, you are ready to continue with the work
1818

1919
[align="center", cols="1", grid="none", frame="none"]
2020
|=====
21-
|image:button-continue-developer.png[link=../../04-path-security-and-networking/401-configmaps-and-secrets]
21+
|image:button-continue-developer.png[link=../../03-path-application-development/310-chaos-engineering/]
2222
|link:../../developer-path.adoc[Go to Developer Index]
2323
|=====
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: name-service
5+
spec:
6+
selector:
7+
app: name-pod
8+
ports:
9+
- port: 8080
10+
---
11+
apiVersion: extensions/v1beta1
12+
kind: ReplicaSet
13+
metadata:
14+
name: name-rs
15+
spec:
16+
replicas: 1
17+
template:
18+
metadata:
19+
labels:
20+
app: name-pod
21+
spec:
22+
containers:
23+
- name: name
24+
image: arungupta/name-service:latest
25+
ports:
26+
- containerPort: 8080
27+
---
28+
apiVersion: v1
29+
kind: Service
30+
metadata:
31+
name: greeter-service
32+
spec:
33+
selector:
34+
app: greeter-pod
35+
ports:
36+
- port: 8080
37+
---
38+
apiVersion: extensions/v1beta1
39+
kind: ReplicaSet
40+
metadata:
41+
name: greeter-rs
42+
spec:
43+
replicas: 1
44+
template:
45+
metadata:
46+
labels:
47+
app: greeter-pod
48+
spec:
49+
containers:
50+
- name: name
51+
image: arungupta/greeter-service:latest
52+
ports:
53+
- containerPort: 8080
54+
---
55+
apiVersion: v1
56+
kind: Service
57+
metadata:
58+
name: webapp-service
59+
spec:
60+
selector:
61+
app: webapp-pod
62+
ports:
63+
- name: web
64+
port: 80
65+
targetPort: 8080
66+
type: LoadBalancer
67+
---
68+
apiVersion: extensions/v1beta1
69+
kind: ReplicaSet
70+
metadata:
71+
name: webapp-rs
72+
spec:
73+
replicas: 1
74+
template:
75+
metadata:
76+
labels:
77+
app: webapp-pod
78+
spec:
79+
containers:
80+
- name: webapp-pod
81+
image: arungupta/webapp-service:latest
82+
env:
83+
- name: NAME_SERVICE_HOST
84+
value: name-service
85+
- name: NAME_SERVICE_PORT
86+
value: "8080"
87+
- name: NAME_SERVICE_PATH
88+
value: /
89+
- name: GREETER_SERVICE_HOST
90+
value: greeter-service
91+
- name: GREETER_SERVICE_PORT
92+
value: "8080"
93+
- name: GREETER_SERVICE_PATH
94+
value: /
95+
ports:
96+
- containerPort: 8080
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"version": "1.0.0",
3+
"title": "Terminating the greeting service should not impact users",
4+
"description": "How does the greeting service unavailbility impacts our users? Do they see an error or does the webapp gets slower?",
5+
"tags": [
6+
"kubernetes",
7+
"aws"
8+
],
9+
"configuration": {
10+
"web_app_url": {
11+
"type": "env",
12+
"key": "WEBAPP_URL"
13+
}
14+
},
15+
"steady-state-hypothesis": {
16+
"title": "Services are all available and healthy",
17+
"probes": [
18+
{
19+
"type": "probe",
20+
"name": "application-should-be-alive-and-healthy",
21+
"tolerance": true,
22+
"provider": {
23+
"type": "python",
24+
"module": "chaosk8s.pod.probes",
25+
"func": "pods_in_phase",
26+
"arguments": {
27+
"label_selector": "app=webapp-pod",
28+
"phase": "Running",
29+
"ns": "default"
30+
}
31+
}
32+
},
33+
{
34+
"type": "probe",
35+
"name": "application-must-respond-normally",
36+
"tolerance": 200,
37+
"provider": {
38+
"type": "http",
39+
"url": "${web_app_url}",
40+
"timeout": 3
41+
}
42+
}
43+
]
44+
},
45+
"method": [
46+
{
47+
"type": "action",
48+
"name": "terminate-greeting-service",
49+
"provider": {
50+
"type": "python",
51+
"module": "chaosk8s.pod.actions",
52+
"func": "terminate_pods",
53+
"arguments": {
54+
"label_selector": "app=greeter-pod",
55+
"ns": "default"
56+
}
57+
}
58+
},
59+
{
60+
"type": "probe",
61+
"name": "fetch-application-logs",
62+
"provider": {
63+
"type": "python",
64+
"module": "chaosk8s.pod.probes",
65+
"func": "read_pod_logs",
66+
"arguments": {
67+
"label_selector": "app=webapp-pod",
68+
"last": "20s",
69+
"ns": "default"
70+
}
71+
}
72+
}
73+
],
74+
"rollbacks": []
75+
}

0 commit comments

Comments
 (0)