Skip to content

Commit

Permalink
fix: added chaos engineering files
Browse files Browse the repository at this point in the history
  • Loading branch information
mati007thm committed Feb 23, 2024
1 parent f27c773 commit c76b5cc
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 0 deletions.
17 changes: 17 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/burn-cpu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: chaos-mesh.org/v1alpha1
kind: StressChaos
metadata:
namespace: 12-factor-app
name: burn-cpu-100
spec:
selector:
namespaces:
- 12-factor-app
labelSelectors:
app.kubernetes.io/instance: 12-factor-app
mode: all
stressors:
cpu:
workers: 1
load: 100
duration: 30s
39 changes: 39 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/chaos-on-the-rise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: chaos-mesh.org/v1alpha1
kind: Workflow
metadata:
name: chaos-on-the-rise
namespace: 12-factor-app
spec:
entry: entry
templates:
- name: entry
templateType: Serial
deadline: 2m
children:
- stress-test
- pod-killer
- name: stress-test
templateType: StressChaos
deadline: 10s
stressChaos:
selector:
namespaces:
- 12-factor-app
labelSelectors:
app: controller
mode: all
stressors:
cpu:
workers: 1
load: 100
- name: pod-killer
templateType: PodChaos
deadline: 60s
podChaos:
selector:
namespaces:
- 12-factor-app
labelSelectors:
app: controller
mode: all
action: pod-kill
14 changes: 14 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: chaos-ingress
namespace: chaos-testing
spec:
entryPoints:
- web
routes:
- match: Host(`chaos.<ENV-NAME>-<ENV-USER-ID>-01.<ENV-ANIMAL>.<ENV-DOMAIN>`) && PathPrefix(`/`)
kind: Rule
services:
- name: chaos-dashboard
port: 2333
20 changes: 20 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/network-bandwith.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: chaos-mesh.org/v1alpha1
kind: NetworkChaos
metadata:
name: network-bandwidth-100kbps
namespace: 12-factor-app
spec:
action: bandwidth
mode: all
selector:
namespaces:
- 12-factor-app
labelSelectors:
app.kubernetes.io/instance: 12-factor-app
bandwidth:
rate: 100kbps
limit: 100
buffer: 10000
peakrate: 1000000
minburst: 1000000
duration: "10s"
17 changes: 17 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/network-corrupt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: chaos-mesh.org/v1alpha1
kind: NetworkChaos
metadata:
name: network-corrupt-example
namespace: 12-factor-app
spec:
action: corrupt
mode: all
selector:
namespaces:
- 12-factor-app
labelSelectors:
app.kubernetes.io/instance: 12-factor-app
corrupt:
corrupt: "40"
correlation: "25"
duration: "10s"
14 changes: 14 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/pod-failure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: chaos-mesh.org/v1alpha1
kind: PodChaos
metadata:
namespace: 12-factor-app
name: pod-failure-example
spec:
selector:
namespaces:
- 12-factor-app # the namespace of the system under test (SUT) you've deployed
labelSelectors:
app.kubernetes.io/instance: 12-factor-app # the label of the pod for chaos injection
mode: all # the mode to run chaos action; supported modes are one/all/fixed/fixed-percent/random-max-percent
action: pod-failure # the specific chaos action to inject; supported actions: pod-kill/pod-failure/container-kill
duration: 60s # duration for the injected chaos experiment
21 changes: 21 additions & 0 deletions dapr-distributed-calendar/chaos-engineering/schedule-chaos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: chaos-mesh.org/v1alpha1
kind: Schedule
metadata:
namespace: 12-factor-app
name: scheduled-pod-failure
spec:
schedule: 5 * * * *
startingDeadlineSeconds: null
concurrencyPolicy: Forbid
historyLimit: 2
type: PodChaos
podChaos:
selector:
namespaces:
- 12-factor-app
labelSelectors:
app: controller
mode: one
action: pod-failure
duration: 1m
gracePeriod: 0
3 changes: 3 additions & 0 deletions dapr-distributed-calendar/kubernetes/go-events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ metadata:
name: go-events
namespace: 12-factor-app
labels:
app.kubernetes.io/instance: 12-factor-app
app: go-events
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: 12-factor-app
app: go-events
template:
metadata:
labels:
app.kubernetes.io/instance: 12-factor-app
app: go-events
annotations:
# instrumentation.opentelemetry.io/inject-go: "go-instrumentation"
Expand Down
5 changes: 5 additions & 0 deletions dapr-distributed-calendar/kubernetes/node-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ metadata:
name: controller
namespace: 12-factor-app
labels:
app.kubernetes.io/instance: 12-factor-app
app: controller
spec:
selector:
app.kubernetes.io/instance: 12-factor-app
app: controller
ports:
- protocol: TCP
Expand All @@ -20,15 +22,18 @@ metadata:
name: controller
namespace: 12-factor-app
labels:
app.kubernetes.io/instance: 12-factor-app
app: controller
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: 12-factor-app
app: controller
template:
metadata:
labels:
app.kubernetes.io/instance: 12-factor-app
app: controller
annotations:
# instrumentation.opentelemetry.io/inject-nodejs: "node-instrumentation"
Expand Down
3 changes: 3 additions & 0 deletions dapr-distributed-calendar/kubernetes/python-messages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ metadata:
name: messages
namespace: 12-factor-app
labels:
app.kubernetes.io/instance: 12-factor-app
app: messages
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: 12-factor-app
app: messages
template:
metadata:
labels:
app.kubernetes.io/instance: 12-factor-app
app: messages
annotations:
# instrumentation.opentelemetry.io/inject-python: "python-instrumentation"
Expand Down

0 comments on commit c76b5cc

Please sign in to comment.