charts(pod-memory-hog): Add Chaos Chart for pod memory hog experiment (#205)

* Add Chaos chart for pod memory hog experiment

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>
This commit is contained in:
UDIT GAURAV
2020-04-10 21:53:31 +05:30
committed by GitHub
parent 9cb94e4ed9
commit 01b334c075
7 changed files with 187 additions and 0 deletions

View File

@@ -24,6 +24,7 @@ spec:
- disk-loss
- disk-fill
- node-memory-hog
- pod-memory-hog
keywords:
- Kubernetes
@@ -32,6 +33,8 @@ spec:
- Pod
- Disk
- Network
- CPU
- Memory
maintainers:
- name: ksatchit
email: karthik.s@mayadata.io

View File

@@ -33,3 +33,6 @@ experiments:
- name: node-memory-hog
CSV: node-memory-hog.chartserviceversion.yaml
desc: "node-memory-hog"
- name: pod-memory-hog
CSV: pod-memory-hog.chartserviceversion.yaml
desc: "pod-memory-hog"

View File

View File

@@ -0,0 +1,38 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
# It can be true/false
annotationCheck: 'true'
# 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-memory-hog-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: 'delete'
experiments:
- name: pod-memory-hog
spec:
components:
env:
# Provide name of target container
# where chaos has to be injected
- name: TARGET_CONTAINER
value: 'nginx'
# Enter the amount of memory in megabytes to be consumed by the application pod
# default: 500 (Megabytes)
- name: MEMORY_CONSUMPTION
value: ''
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds

View File

@@ -0,0 +1,65 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Injects memory consumption on pods belonging to an app deployment
kind: ChaosExperiment
metadata:
name: pod-memory-hog
version: 0.1.0
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"
args:
- -c
- ansible-playbook ./experiments/generic/pod_memory_hog/pod_memory_hog_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0
command:
- /bin/bash
env:
- name: ANSIBLE_STDOUT_CALLBACK
value: 'default'
# Provide name of target container
# where chaos has to be injected
- name: TARGET_CONTAINER
value: ''
# Enter the amount of memory in megabytes to be consumed by the application pod
# default: 500 (Megabytes)
- name: MEMORY_CONSUMPTION
value: '500'
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds
# Period to wait before and after injection of chaos in sec
- name: RAMP_TIME
value: ''
- name: LIB
value: 'litmus'
- name: LIB_IMAGE
value: 'litmuschaos/app-memory-stress:latest'
labels:
name: pod-memory-hog

View File

@@ -0,0 +1,42 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
createdAt: 2020-04-10T10:28:08Z
name: pod-memory-hog
version: 0.1.0
annotations:
categories: Kubernetes
vendor: CNCF
support: https://slack.kubernetes.io/
spec:
displayName: pod-memory-hog
categoryDescription: |
Pod-Memory-Hog contains chaos to consume Memory resouces of specified containers in Kubernetes pods.
- Consumes the memory specified by executing a dd command against special files /dev/zero(input) and /dev/null(output)
- The application pod should be healthy once chaos is stopped. Expectation is that service-requests should be served despite chaos.
keywords:
- Kubernetes
- Memory
platforms:
- GKE
- Packet(Kubeadm)
- Minikube
- EKS
maturity: alpha
maintainers:
- name: Udit Gaurav
email: udit.gaurav@mayadata.io
minKubeVersion: 1.12.0
provider:
name: Mayadata
links:
- name: Source Code
url: https://github.com/litmuschaos/litmus/tree/master/experiments/generic/pod_memory_hog
- name: Documentation
url: https://docs.litmuschaos.io/docs/pod-memory-hog/
- name: Video
url:
icon:
- base64data: ""
mediatype: ""
chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/pod-memory-hog/experiment.yaml

View File

@@ -0,0 +1,36 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-memory-hog-sa
namespace: default
labels:
name: pod-memory-hog-sa
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: pod-memory-hog-sa
namespace: default
labels:
name: pod-memory-hog-sa
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/v1beta1
kind: RoleBinding
metadata:
name: pod-memory-hog-sa
namespace: default
labels:
name: pod-memory-hog-sa
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-memory-hog-sa
subjects:
- kind: ServiceAccount
name: pod-memory-hog-sa
namespace: default