feat(charts): Adding chaos charts for node-memory-hog experiment (#163)

* feat(charts): Adding chaos charts for node-memory-hog experiment

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>
This commit is contained in:
UDIT GAURAV
2020-03-12 20:07:44 +05:30
committed by GitHub
parent 3e48a8fe43
commit 3bac172da5
9 changed files with 194 additions and 7 deletions

View File

@@ -23,6 +23,7 @@ spec:
- node-cpu-hog - node-cpu-hog
- disk-loss - disk-loss
- disk-fill - disk-fill
- node-memory-hog
keywords: keywords:
- Kubernetes - Kubernetes

View File

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

View File

@@ -19,7 +19,6 @@ spec:
- "daemonsets" - "daemonsets"
- "jobs" - "jobs"
- "pods" - "pods"
- "pods/exec"
- "events" - "events"
- "chaosengines" - "chaosengines"
- "chaosexperiments" - "chaosexperiments"

View File

@@ -11,14 +11,15 @@ metadata:
spec: spec:
displayName: node-cpu-hog displayName: node-cpu-hog
categoryDescription: | categoryDescription: |
Node CPU hog contains chaos to disrupt state of kubernetes resources. Experiments can inject a cpu skipe on a node where the application pod is scheduled. Node CPU hog contains chaos to disrupt the state of Kubernetes resources. Experiments can inject a CPU spike on a node where the application pod is scheduled.
- Causes (forced/graceful) cpu hog on a perticular node where the application deployment is available. - CPU hog on a particular node where the application deployment is available.
- After test the recovery should be manual of the application pod and node in case they are not in appropriate state. - After test, the recovery should be manual for the application pod and node in case they are not in an appropriate state.
keywords: keywords:
- Kubernetes - Kubernetes
- CPU - CPU
- State - State
- Node
platforms: platforms:
- GKE - GKE
maturity: alpha maturity: alpha

View File

@@ -15,7 +15,7 @@ metadata:
name: node-cpu-hog-sa name: node-cpu-hog-sa
rules: rules:
- apiGroups: ["","litmuschaos.io","batch","apps"] - apiGroups: ["","litmuschaos.io","batch","apps"]
resources: ["pods","daemonsets","jobs","pods/exec","events","chaosengines","chaosexperiments","chaosresults"] resources: ["pods","jobs","events","chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update","delete"] verbs: ["create","list","get","patch","update","delete"]
- apiGroups: [""] - apiGroups: [""]
resources: ["nodes"] resources: ["nodes"]

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: 'false'
# 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: node-memory-hog-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: 'delete'
experiments:
- name: node-memory-hog
spec:
components:
env:
# set chaos duration (in sec) as desired
- name: TOTAL_CHAOS_DURATION
value: '60'
## specify the size as percent of total available memory (in percentage %)
## default value 90%
- name: MEMORY_PERCENTAGE
value: '90'
# set chaos platform as desired
- name: PLATFORM
value: 'GKE'
# chaos lib used to inject the chaos
- name: LIB
value: 'litmus'

View File

@@ -0,0 +1,65 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Give a memory hog on a node belonging to a deployment
kind: ChaosExperiment
metadata:
name: node-memory-hog
version: 0.1.0
spec:
definition:
scope: Cluster
permissions:
- apiGroups:
- ""
- "batch"
- "apps"
- "litmuschaos.io"
resources:
- "jobs"
- "pods"
- "pods/log"
- "events"
- "chaosengines"
- "chaosexperiments"
- "chaosresults"
verbs:
- "create"
- "list"
- "get"
- "patch"
- "update"
- "delete"
- apiGroups:
- ""
resources:
- "nodes"
verbs :
- "get"
- "list"
image: "litmuschaos/ansible-runner:latest"
args:
- -c
- ansible-playbook ./experiments/generic/node_memory_hog/node_memory_hog_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0
command:
- /bin/bash
env:
- name: ANSIBLE_STDOUT_CALLBACK
value: 'default'
- name: TOTAL_CHAOS_DURATION
value: '60'
# Period to wait before injection of chaos in sec
- name: RAMP_TIME
value: ''
- name: PLATFORM
value: 'GKE'
- name: LIB
value: 'litmus'
labels:
name: node-memory-hog

View File

@@ -0,0 +1,43 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
createdAt: 2020-03-28T10:28:08Z
name: node-memory-hog
version: 0.1.0
annotations:
categories: Kubernetes
vendor: CNCF
support: https://slack.kubernetes.io/
spec:
displayName: node-memory-hog
categoryDescription: |
Kubernetes Node memory hog contains chaos to disrupt the state of Kubernetes resources. Experiments can inject a memory spike on a node where the application pod is scheduled.
- Memory hog on a particular node where the application deployment is available.
- After the test, the recovery should be manual for the application pod and node in case they are not in an appropriate state.
keywords:
- Kubernetes
- Memory
- State
- Node
platforms:
- GKE
maturity: alpha
chaosType: infra
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/node_memory_hog
- name: Documentation
url: https://docs.litmuschaos.io/docs/node-memory-hog/
- name: Video
url:
icon:
- url: ""
mediatype: ""
chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/node-memory-hog/experiment.yaml

View File

@@ -0,0 +1,37 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: node-memory-hog-sa
namespace: default
labels:
name: node-memory-hog-sa
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: node-memory-hog-sa
labels:
name: node-memory-hog-sa
rules:
- apiGroups: ["","litmuschaos.io","batch","apps"]
resources: ["pods","jobs","pods/log","events","chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update","delete"]
- apiGroups: [""]
resources: ["nodes"]
verbs : ["get","list"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: node-memory-hog-sa
labels:
name: node-memory-hog-sa
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: node-memory-hog-sa
subjects:
- kind: ServiceAccount
name: node-memory-hog-sa
namespace: default