Feature(Chart): Chaos charts for Docker Service Kill experiment (#261)

* Chaos charts for Docker Service Kill experiment
This commit is contained in:
ghoshankur1983
2020-07-14 16:37:07 +05:30
committed by GitHub
parent 133281e288
commit 14581f5fdb
4 changed files with 150 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
name: docker-service-kill
version: 0.1.0
annotations:
categories: docker-service-kill
repository: https://github.com/litmuschaos/litmus-ansible/tree/master/generic/docker-service-kill
support: https://kubernetes.slack.com/messages/CNXNB0ZTN
spec:
displayName: docker-service-kill
categoryDescription: >
Randomly stops Docker services temporarily
keywords: ['pods', 'kubernetes', 'nginx']
maturity: alpha
minKubeVersion: 1.12.0
provider: {'name': 'Wipro'}
maintainers: ['ankur.ghosh3@wipro.com']
contributors: ['ankur.ghosh3@wipro.com']
links: ['https://docs.litmuschaos.io/docs/getstarted/']
icon:
- url:
mediatype: ""

View File

@@ -0,0 +1,28 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
# It can be true/false
annotationCheck: 'false'
# It can be active/stop
engineState: 'active'
#ex. values: ns1:name=percona,ns2:run=nginx
auxiliaryAppInfo: ''
chaosServiceAccount: docker-service-kill-sa
monitoring: false
# It can be delete/retain
jobCleanUpPolicy: 'delete'
experiments:
- name: docker-service-kill
spec:
components:
env:
# set chaos duration (in sec) as desired
- name: TOTAL_CHAOS_DURATION
value: '90'

View File

@@ -0,0 +1,62 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Kills the docker service on the application node to check the resiliency.
kind: ChaosExperiment
metadata:
name: docker-service-kill
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:ci"
imagePullPolicy: Always
args:
- -c
- ansible-playbook ./experiments/generic/docker_service_kill/docker_service_kill_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: '90' # in seconds
# Period to wait before injection of chaos in sec
- name: RAMP_TIME
value: ''
- name: LIB
value: 'litmus'
labels:
name: docker-service-kill

View File

@@ -0,0 +1,37 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: docker-service-kill-sa
namespace: default
labels:
name: docker-service-kill-sa
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: docker-service-kill-sa
labels:
name: docker-service-kill-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: docker-service-kill-sa
labels:
name: docker-service-kill-sa
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: docker-service-kill-sa
subjects:
- kind: ServiceAccount
name: docker-service-kill-sa
namespace: default