Skip to content

Commit f6654de

Browse files
committed
use ubuntu:jammy, use var/consts where applicable, update readme
1 parent 2441e91 commit f6654de

File tree

5 files changed

+65
-79
lines changed

5 files changed

+65
-79
lines changed

dogfood/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Installing protoc
1+
# Installing protoc
22

33
Run `brew install protobuf` or `make install-protobuf`
44

@@ -107,8 +107,8 @@ For gRPC disruption, you can follow these [detailed steps](../docs/grpc_disrupti
107107
### Sending Metrics to Datadog
108108
109109
For the purposes of testing disruptions/workflows, you should make sure that the datadog agent is properly installed
110-
on the cluster that the client and server are running on. 3 of the major disruptive resources properly send metrics
111-
to Datadog (CPU, Network, Disk). The client contains computation related to these disruptions and can be tested using
110+
on the cluster that the client and server are running on. The Datadog Agent should be posting metrics related to CPU,
111+
Network, and Disk which are all necessary to test the related disruptions. The client contains computation related to these disruptions and can be tested using
112112
the disruptions mentioned.
113113
114114
### Clean up

dogfood/client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:focal as client
1+
FROM ubuntu:jammy as client
22

33
COPY built_go_client /usr/local/bin/dogfood_client
44

dogfood/server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:focal as client
1+
FROM ubuntu:jammy as client
22

33
COPY built_go_server /usr/local/bin/dogfood_server
44

dogfood/tester/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:focal as client
1+
FROM ubuntu:jammy as client
22

33
COPY built_go_client /usr/local/bin/dogfood_tester
44

dogfood/tester/disruptions.go

Lines changed: 59 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package main
77

88
import (
9+
"fmt"
910
"github.com/DataDog/chaos-controller/api/v1beta1"
1011
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1112
"k8s.io/apimachinery/pkg/util/intstr"
@@ -14,30 +15,39 @@ import (
1415
// Globals
1516

1617
var SELECTOR = []string{"app", "chaos-dogfood-client"}
17-
var CONTAINER = "client-deploy"
18+
19+
const CONTAINER = "client-deploy"
20+
const NAMESPACE = "chaos-engineering"
21+
const NAME_PREFIX = "e2etest-"
22+
const DURATION v1beta1.DisruptionDuration = "3m"
23+
const DISK_PRESSURE_PATH = "/mnt/data"
24+
25+
var COUNT = &intstr.IntOrString{Type: intstr.Int, IntVal: 1}
26+
var UNSAFEMODE = &v1beta1.UnsafemodeSpec{
27+
DisableAll: true,
28+
}
29+
var NETWORK_HOST_SPEC = []v1beta1.NetworkDisruptionHostSpec{
30+
{
31+
Host: fmt.Sprintf("chaos-dogfood-server.%s.svc.cluster.local", NAMESPACE),
32+
Port: 50051,
33+
Protocol: "tcp",
34+
},
35+
}
1836

1937
// Network Disruptions
2038
var network1 = v1beta1.Disruption{
2139
ObjectMeta: metav1.ObjectMeta{
22-
Name: "e2etest-network1",
23-
Namespace: "chaos-engineering",
40+
Name: fmt.Sprint(NAME_PREFIX, "network-drop30"),
41+
Namespace: NAMESPACE,
2442
},
2543
Spec: v1beta1.DisruptionSpec{
26-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
27-
Unsafemode: &v1beta1.UnsafemodeSpec{
28-
DisableAll: true,
29-
},
44+
Count: COUNT,
45+
Unsafemode: UNSAFEMODE,
3046
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
3147
Containers: []string{CONTAINER},
32-
Duration: "3m",
48+
Duration: DURATION,
3349
Network: &v1beta1.NetworkDisruptionSpec{
34-
Hosts: []v1beta1.NetworkDisruptionHostSpec{
35-
{
36-
Host: "chaos-dogfood-server.chaos-demo.svc.cluster.local",
37-
Port: 50051,
38-
Protocol: "tcp",
39-
},
40-
},
50+
Hosts: NETWORK_HOST_SPEC,
4151
Drop: 30,
4252
Corrupt: 0,
4353
Delay: 0,
@@ -48,25 +58,17 @@ var network1 = v1beta1.Disruption{
4858

4959
var network2 = v1beta1.Disruption{
5060
ObjectMeta: metav1.ObjectMeta{
51-
Name: "e2etest-network2",
52-
Namespace: "chaos-engineering",
61+
Name: fmt.Sprint(NAME_PREFIX, "network-drop70"),
62+
Namespace: NAMESPACE,
5363
},
5464
Spec: v1beta1.DisruptionSpec{
55-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
56-
Unsafemode: &v1beta1.UnsafemodeSpec{
57-
DisableAll: true,
58-
},
65+
Count: COUNT,
66+
Unsafemode: UNSAFEMODE,
5967
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
6068
Containers: []string{CONTAINER},
61-
Duration: "3m",
69+
Duration: DURATION,
6270
Network: &v1beta1.NetworkDisruptionSpec{
63-
Hosts: []v1beta1.NetworkDisruptionHostSpec{
64-
{
65-
Host: "chaos-dogfood-server.chaos-demo.svc.cluster.local",
66-
Port: 50051,
67-
Protocol: "tcp",
68-
},
69-
},
71+
Hosts: NETWORK_HOST_SPEC,
7072
Drop: 70,
7173
Corrupt: 0,
7274
Delay: 0,
@@ -77,25 +79,17 @@ var network2 = v1beta1.Disruption{
7779

7880
var network3 = v1beta1.Disruption{
7981
ObjectMeta: metav1.ObjectMeta{
80-
Name: "e2etest-network3",
81-
Namespace: "chaos-engineering",
82+
Name: fmt.Sprint(NAME_PREFIX, "network-delay1000"),
83+
Namespace: NAMESPACE,
8284
},
8385
Spec: v1beta1.DisruptionSpec{
84-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
85-
Unsafemode: &v1beta1.UnsafemodeSpec{
86-
DisableAll: true,
87-
},
86+
Count: COUNT,
87+
Unsafemode: UNSAFEMODE,
8888
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
8989
Containers: []string{CONTAINER},
90-
Duration: "3m",
90+
Duration: DURATION,
9191
Network: &v1beta1.NetworkDisruptionSpec{
92-
Hosts: []v1beta1.NetworkDisruptionHostSpec{
93-
{
94-
Host: "chaos-dogfood-server.chaos-demo.svc.cluster.local",
95-
Port: 50051,
96-
Protocol: "tcp",
97-
},
98-
},
92+
Hosts: NETWORK_HOST_SPEC,
9993
Drop: 0,
10094
Corrupt: 0,
10195
Delay: 1000,
@@ -111,19 +105,17 @@ var diskReadsThresholds = []int{1024, 2048, 4098}
111105

112106
var disk1 = v1beta1.Disruption{
113107
ObjectMeta: metav1.ObjectMeta{
114-
Name: "e2etest-disk1",
115-
Namespace: "chaos-engineering",
108+
Name: fmt.Sprint(NAME_PREFIX, "disk-read1024"),
109+
Namespace: NAMESPACE,
116110
},
117111
Spec: v1beta1.DisruptionSpec{
118-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
119-
Unsafemode: &v1beta1.UnsafemodeSpec{
120-
DisableAll: true,
121-
},
112+
Count: COUNT,
113+
Unsafemode: UNSAFEMODE,
122114
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
123115
Containers: []string{CONTAINER},
124-
Duration: "3m",
116+
Duration: DURATION,
125117
DiskPressure: &v1beta1.DiskPressureSpec{
126-
Path: "/mnt/data",
118+
Path: DISK_PRESSURE_PATH,
127119
Throttling: v1beta1.DiskPressureThrottlingSpec{
128120
ReadBytesPerSec: &diskReadsThresholds[0],
129121
},
@@ -133,19 +125,17 @@ var disk1 = v1beta1.Disruption{
133125

134126
var disk2 = v1beta1.Disruption{
135127
ObjectMeta: metav1.ObjectMeta{
136-
Name: "e2etest-disk2",
137-
Namespace: "chaos-engineering",
128+
Name: fmt.Sprint(NAME_PREFIX, "disk-write2048"),
129+
Namespace: NAMESPACE,
138130
},
139131
Spec: v1beta1.DisruptionSpec{
140-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
141-
Unsafemode: &v1beta1.UnsafemodeSpec{
142-
DisableAll: true,
143-
},
132+
Count: COUNT,
133+
Unsafemode: UNSAFEMODE,
144134
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
145135
Containers: []string{CONTAINER},
146-
Duration: "3m",
136+
Duration: DURATION,
147137
DiskPressure: &v1beta1.DiskPressureSpec{
148-
Path: "/mnt/data",
138+
Path: DISK_PRESSURE_PATH,
149139
Throttling: v1beta1.DiskPressureThrottlingSpec{
150140
WriteBytesPerSec: &diskReadsThresholds[1],
151141
},
@@ -155,17 +145,15 @@ var disk2 = v1beta1.Disruption{
155145

156146
var disk3 = v1beta1.Disruption{
157147
ObjectMeta: metav1.ObjectMeta{
158-
Name: "e2etest-disk3",
159-
Namespace: "chaos-engineering",
148+
Name: fmt.Sprint(NAME_PREFIX, "disk-write4098"),
149+
Namespace: NAMESPACE,
160150
},
161151
Spec: v1beta1.DisruptionSpec{
162-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
163-
Unsafemode: &v1beta1.UnsafemodeSpec{
164-
DisableAll: true,
165-
},
152+
Count: COUNT,
153+
Unsafemode: UNSAFEMODE,
166154
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
167155
Containers: []string{CONTAINER},
168-
Duration: "3m",
156+
Duration: DURATION,
169157
DiskPressure: &v1beta1.DiskPressureSpec{
170158
Path: "/mnt/data",
171159
Throttling: v1beta1.DiskPressureThrottlingSpec{
@@ -181,17 +169,15 @@ var DISK_DISRUPTIONS = []v1beta1.Disruption{disk1, disk2, disk3}
181169

182170
var cpu1 = v1beta1.Disruption{
183171
ObjectMeta: metav1.ObjectMeta{
184-
Name: "e2etest-cpu1",
185-
Namespace: "chaos-engineering",
172+
Name: fmt.Sprint(NAME_PREFIX, "cpu-cores4"),
173+
Namespace: NAMESPACE,
186174
},
187175
Spec: v1beta1.DisruptionSpec{
188-
Count: &intstr.IntOrString{Type: intstr.Int, IntVal: 1},
189-
Unsafemode: &v1beta1.UnsafemodeSpec{
190-
DisableAll: true,
191-
},
176+
Count: COUNT,
177+
Unsafemode: UNSAFEMODE,
192178
Selector: map[string]string{SELECTOR[0]: SELECTOR[1]},
193179
Containers: []string{CONTAINER},
194-
Duration: "3m",
180+
Duration: DURATION,
195181
CPUPressure: &v1beta1.CPUPressureSpec{
196182
Count: &intstr.IntOrString{IntVal: 4},
197183
},

0 commit comments

Comments
 (0)