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:
38
charts/generic/pod-cpu-hog/ansible/engine.yaml
Normal file
38
charts/generic/pod-cpu-hog/ansible/engine.yaml
Normal 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-cpu-hog-sa
|
||||
monitoring: false
|
||||
# It can be delete/retain
|
||||
jobCleanUpPolicy: 'delete'
|
||||
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
|
||||
|
62
charts/generic/pod-cpu-hog/ansible/experiment.yaml
Normal file
62
charts/generic/pod-cpu-hog/ansible/experiment.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
description:
|
||||
message: |
|
||||
Injects cpu consumption on pods belonging to an app deployment
|
||||
kind: ChaosExperiment
|
||||
metadata:
|
||||
name: pod-cpu-hog
|
||||
version: 0.1.11
|
||||
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:1.6.0"
|
||||
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
|
36
charts/generic/pod-cpu-hog/ansible/rbac.yaml
Normal file
36
charts/generic/pod-cpu-hog/ansible/rbac.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: pod-cpu-hog-sa
|
||||
namespace: default
|
||||
labels:
|
||||
name: pod-cpu-hog-sa
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: pod-cpu-hog-sa
|
||||
namespace: default
|
||||
labels:
|
||||
name: pod-cpu-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-cpu-hog-sa
|
||||
namespace: default
|
||||
labels:
|
||||
name: pod-cpu-hog-sa
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: pod-cpu-hog-sa
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: pod-cpu-hog-sa
|
||||
namespace: default
|
Reference in New Issue
Block a user