Chore(stress-chaos): Add stress chaos charts (#475)

Signed-off-by: udit <udit@chaosnative.com>

Co-authored-by: Shubham Chaudhary <shubham.chaudhary@mayadata.io>
This commit is contained in:
Udit Gaurav
2021-06-16 03:32:25 +05:30
committed by GitHub
parent 2c87b79afb
commit 00570a79dc
25 changed files with 511 additions and 217 deletions

View File

@@ -1,33 +0,0 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
# It can be active/stop
engineState: 'active'
#ex. values: ns1:name=percona,ns2:run=nginx
auxiliaryAppInfo: ''
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
chaosServiceAccount: pod-cpu-hog-sa
experiments:
- name: pod-cpu-hog
spec:
components:
env:
# Provide name of target container
# where chaos has to be injected
- name: TARGET_CONTAINER
value: 'nginx'
#number of cpu cores to be consumed
#verify the resources the app has been launched with
- name: CPU_CORES
value: '1'
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds

View File

@@ -1,69 +0,0 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Injects cpu consumption on pods belonging to an app deployment
kind: ChaosExperiment
metadata:
name: pod-cpu-hog
labels:
name: pod-cpu-hog
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: chaosexperiment
app.kubernetes.io/version: latest
spec:
definition:
scope: Namespaced
permissions:
- apiGroups:
- ""
- "batch"
- "litmuschaos.io"
resources:
- "jobs"
- "pods"
- "pods/log"
- "events"
- "chaosengines"
- "chaosexperiments"
- "chaosresults"
verbs:
- "create"
- "list"
- "get"
- "patch"
- "update"
- "delete"
image: "litmuschaos/ansible-runner:latest"
imagePullPolicy: Always
args:
- -c
- ansible-playbook ./experiments/generic/pod_cpu_hog/pod_cpu_hog_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0
command:
- /bin/bash
env:
- name: ANSIBLE_STDOUT_CALLBACK
value: 'default'
- name: TARGET_CONTAINER
value: ''
- name: CPU_CORES
value: '1'
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds
# Period to wait before injection of chaos in sec
- name: RAMP_TIME
value: ''
- name: LIB
value: 'litmus'
- name: LIB_IMAGE
value: 'litmuschaos/app-cpu-stress:latest'
labels:
name: pod-cpu-hog
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: experiment-job
app.kubernetes.io/version: latest

View File

@@ -1,39 +0,0 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-cpu-hog-sa
namespace: default
labels:
name: pod-cpu-hog-sa
app.kubernetes.io/part-of: litmus
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-cpu-hog-sa
namespace: default
labels:
name: pod-cpu-hog-sa
app.kubernetes.io/part-of: litmus
rules:
- apiGroups: ["","litmuschaos.io","batch"]
resources: ["pods","jobs","events","pods/log","chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update","delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-cpu-hog-sa
namespace: default
labels:
name: pod-cpu-hog-sa
app.kubernetes.io/part-of: litmus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-cpu-hog-sa
subjects:
- kind: ServiceAccount
name: pod-cpu-hog-sa
namespace: default

View File

@@ -17,10 +17,8 @@ spec:
spec:
components:
env:
#number of cpu cores to be consumed
#verify the resources the app has been launched with
- name: CPU_CORES
value: '1'
value: '1'
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds
value: '60' # in seconds

View File

@@ -45,7 +45,7 @@ spec:
- "update"
- "delete"
- "deletecollection"
image: "litmuschaos/go-runner:latest"
image: "litmuschaos/go-runner:ci"
imagePullPolicy: Always
args:
- -c
@@ -58,7 +58,7 @@ spec:
## Number of CPU cores to stress
- name: CPU_CORES
value: '1'
value: '1'
## Percentage of total pods to target
- name: PODS_AFFECTED_PERC
@@ -75,11 +75,15 @@ spec:
## It is used in pumba lib only
- name: LIB_IMAGE
value: 'litmuschaos/go-runner:latest'
value: 'litmuschaos/go-runner:ci'
## It is used in pumba lib only
- name: STRESS_IMAGE
value: 'alexeiled/stress-ng:latest-ubuntu'
value: 'alexeiled/stress-ng:latest-ubuntu'
## provide the cluster runtime
- name: CONTAINER_RUNTIME
value: 'docker'
# provide the socket file path
# it is used in pumba lib

View File

@@ -1,9 +1,9 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
createdAt: 2019-01-07T10:28:08Z
createdAt: 2021-06-16T10:28:08Z
name: pod-cpu-hog
version: 0.1.8
version: 0.1.0
annotations:
categories: Kubernetes
vendor: CNCF
@@ -11,8 +11,9 @@ metadata:
spec:
displayName: pod-cpu-hog
categoryDescription: |
Pod-CPU-Hog contains chaos to consume CPU resouces of specified containers in Kubernetes pods.
- Causes high CPU resource consumption utilizing one or more cores by triggering md5sum commands
Pod-CPU-Hog contains chaos to consume CPU resouces of specified containers in Kubernetes pods.
- Causes CPU resource consumption on specified application containers using cgroups and litmus nsutil which consume CPU resources of the given target containers.
- It Can test the application's resilience to potential slowness/unavailability of some replicas due to high CPU load
- The application pod should be healthy once chaos is stopped. Expectation is that service-requests should be served despite chaos.
keywords:
- Kubernetes
@@ -27,10 +28,12 @@ spec:
maturity: alpha
maintainers:
- name: ksatchit
email: karthik.s@mayadata.io
email: karthik@chaosnative.com
- name: Udit Gaurav
email: udit@chaosnative.com
minKubeVersion: 1.12.0
provider:
name: Mayadata
name: ChaosNative
labels:
app.kubernetes.io/component: chartserviceversion
app.kubernetes.io/version: latest