diff --git a/dapr-distributed-calendar/chaos-engineering/burn-cpu.yaml b/dapr-distributed-calendar/chaos-engineering/burn-cpu.yaml new file mode 100644 index 0000000..a317052 --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/burn-cpu.yaml @@ -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 diff --git a/dapr-distributed-calendar/chaos-engineering/chaos-on-the-rise.yaml b/dapr-distributed-calendar/chaos-engineering/chaos-on-the-rise.yaml new file mode 100644 index 0000000..90711fa --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/chaos-on-the-rise.yaml @@ -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 diff --git a/dapr-distributed-calendar/chaos-engineering/ingress.yaml b/dapr-distributed-calendar/chaos-engineering/ingress.yaml new file mode 100644 index 0000000..16a7e29 --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/ingress.yaml @@ -0,0 +1,14 @@ +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: chaos-ingress + namespace: chaos-testing +spec: + entryPoints: + - web + routes: + - match: Host(`chaos.--01..`) && PathPrefix(`/`) + kind: Rule + services: + - name: chaos-dashboard + port: 2333 diff --git a/dapr-distributed-calendar/chaos-engineering/network-bandwith.yaml b/dapr-distributed-calendar/chaos-engineering/network-bandwith.yaml new file mode 100644 index 0000000..eee4630 --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/network-bandwith.yaml @@ -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" \ No newline at end of file diff --git a/dapr-distributed-calendar/chaos-engineering/network-corrupt.yaml b/dapr-distributed-calendar/chaos-engineering/network-corrupt.yaml new file mode 100644 index 0000000..5ac07cd --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/network-corrupt.yaml @@ -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" diff --git a/dapr-distributed-calendar/chaos-engineering/pod-failure.yaml b/dapr-distributed-calendar/chaos-engineering/pod-failure.yaml new file mode 100644 index 0000000..b64b298 --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/pod-failure.yaml @@ -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 diff --git a/dapr-distributed-calendar/chaos-engineering/schedule-chaos.yaml b/dapr-distributed-calendar/chaos-engineering/schedule-chaos.yaml new file mode 100644 index 0000000..5dda833 --- /dev/null +++ b/dapr-distributed-calendar/chaos-engineering/schedule-chaos.yaml @@ -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 diff --git a/dapr-distributed-calendar/kubernetes/go-events.yaml b/dapr-distributed-calendar/kubernetes/go-events.yaml index 9985dca..237fa81 100644 --- a/dapr-distributed-calendar/kubernetes/go-events.yaml +++ b/dapr-distributed-calendar/kubernetes/go-events.yaml @@ -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" diff --git a/dapr-distributed-calendar/kubernetes/node-controller.yaml b/dapr-distributed-calendar/kubernetes/node-controller.yaml index 4dce9a3..473a215 100644 --- a/dapr-distributed-calendar/kubernetes/node-controller.yaml +++ b/dapr-distributed-calendar/kubernetes/node-controller.yaml @@ -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 @@ -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" diff --git a/dapr-distributed-calendar/kubernetes/python-messages.yaml b/dapr-distributed-calendar/kubernetes/python-messages.yaml index 1fca0a3..bf2e483 100644 --- a/dapr-distributed-calendar/kubernetes/python-messages.yaml +++ b/dapr-distributed-calendar/kubernetes/python-messages.yaml @@ -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"