charts(ansible): Add ansible chaos charts for running ansible experiments (#272)

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>

Co-authored-by: Karthik Satchitanand <karthik.s@mayadata.io>
This commit is contained in:
UDIT GAURAV
2020-07-21 13:16:28 +05:30
committed by GitHub
parent eb5a49065a
commit 6ebfd3057e
39 changed files with 1731 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
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-cpu-hog-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: 'delete'
experiments:
- name: node-cpu-hog
spec:
components:
env:
# set chaos duration (in sec) as desired
- name: TOTAL_CHAOS_DURATION
value: '60'
- name: NODE_CPU_CORE
value: ''

View File

@@ -0,0 +1,74 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Give a cpu spike on a node belonging to a deployment
kind: ChaosExperiment
metadata:
name: node-cpu-hog
version: 0.1.19
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:1.6.0"
imagePullPolicy: Always
args:
- -c
- ansible-playbook ./experiments/generic/node_cpu_hog/node_cpu_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: ''
## ENTER THE NUMBER OF CORES OF CPU FOR CPU HOGGING
## OPTIONAL VALUE IN CASE OF EMPTY VALUE IT WILL TAKE NODE CPU CAPACITY
- name: NODE_CPU_CORE
value: ''
# PROVIDE THE LIB HERE
# ONLY LITMUS SUPPORTED
- name: LIB
value: 'litmus'
# provide lib image
- name: LIB_IMAGE
value: 'litmuschaos/stress-ng:latest'
labels:
name: node-cpu-hog

View File

@@ -0,0 +1,37 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: node-cpu-hog-sa
namespace: default
labels:
name: node-cpu-hog-sa
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: node-cpu-hog-sa
labels:
name: node-cpu-hog-sa
rules:
- apiGroups: ["","litmuschaos.io","batch","apps"]
resources: ["pods","jobs","events","chaosengines","pods/log","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-cpu-hog-sa
labels:
name: node-cpu-hog-sa
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: node-cpu-hog-sa
subjects:
- kind: ServiceAccount
name: node-cpu-hog-sa
namespace: default