Chore(ebs-loss): Add EBS Loss By Tag Experiment (#459)

* Chore(ebs-loss): Add EBS Loss By Tag Experiment

Signed-off-by: uditgaurav <udit@chaosnative.com>
This commit is contained in:
Udit Gaurav
2021-05-15 19:57:05 +05:30
committed by GitHub
parent f024ca968a
commit a9c07c7fd6
16 changed files with 257 additions and 47 deletions

View File

@@ -0,0 +1,45 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
createdAt: 2020-10-28T10:28:08Z
name: ebs-loss-by-id
version: 0.1.0
annotations:
categories: Kubernetes
vendor: CNCF
support: https://slack.kubernetes.io/
spec:
displayName: ebs-loss-by-id
categoryDescription: |
EBS Loss By ID contains chaos to disrupt state of infra resources. The experiment can induce ebs volume loss against specified application for the give EBS Volume(s).
- Causes ebs volume loss from node or ec2 instance for a certain chaos interval from total chaos duration.
- Tests deployment sanity (replica availability & uninterrupted service) and recovery workflows of the application pod
keywords:
- Kubernetes
- EBS
- Volume
- ID
- State
platforms:
- AWS
maturity: alpha
chaosType: infra
maintainers:
- name: Udit Gaurav
email: uditgaurav@mayadata.io
provider:
name: Mayadata
labels:
app.kubernetes.io/component: chartserviceversion
app.kubernetes.io/version: latest
links:
- name: Source Code
url: https://github.com/litmuschaos/litmus-go/tree/master/experiments/kube-aws/ebs-loss-by-id
- name: Documentation
url: https://docs.litmuschaos.io/docs/ebs-loss-by-id/
- name: Video
url:
icon:
- url:
mediatype: ""
chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/kube-aws/ebs-loss-by-id/experiment.yaml

View File

@@ -0,0 +1,31 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-chaos
namespace: default
spec:
engineState: 'active'
annotationCheck: 'false'
chaosServiceAccount: ebs-loss-by-id-sa
# It can be retain/delete
jobCleanUpPolicy: 'delete'
experiments:
- name: ebs-loss-by-id
spec:
components:
env:
# set chaos duration (in sec) as desired
- name: TOTAL_CHAOS_DURATION
value: '30'
# set chaos duration (in sec) as desired
- name: CHAOS_INTERVAL
value: '30'
# set target ebs volume ID
- name: EBS_VOLUME_ID
value: ''
# provide the region name of the instance
- name: REGION
value: ''

View File

@@ -0,0 +1,81 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Detaching an ebs volume from ec2 instance.
kind: ChaosExperiment
metadata:
name: ebs-loss-by-id
labels:
name: ebs-loss-by-id
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: chaosexperiment
app.kubernetes.io/version: latest
spec:
definition:
scope: Cluster
permissions:
- apiGroups:
- ""
- "batch"
- "litmuschaos.io"
resources:
- "jobs"
- "pods"
- "events"
- "pods/log"
- "pods/exec"
- "secrets"
- "chaosengines"
- "chaosexperiments"
- "chaosresults"
verbs:
- "create"
- "list"
- "get"
- "patch"
- "update"
- "delete"
image: "litmuschaos/go-runner:latest"
imagePullPolicy: Always
args:
- -c
- ./experiments -name ebs-loss-by-id
command:
- /bin/bash
env:
- name: TOTAL_CHAOS_DURATION
value: '30'
- name: CHAOS_INTERVAL
value: '30'
# Period to wait before and after injection of chaos in sec
- name: RAMP_TIME
value: ''
- name: EBS_VOLUME_ID
value: ''
- name: REGION
value: ''
- name: SEQUENCE
value: 'parallel'
# Provide the path of aws credentials mounted from secret
- name: AWS_SHARED_CREDENTIALS_FILE
value: '/tmp/cloud_config.yml'
# provide the LIB
# only litmus supported
- name: LIB
value: 'litmus'
labels:
name: ebs-loss-by-id
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: experiment-job
app.kubernetes.io/version: latest
secrets:
- name: cloud-secret
mountPath: /tmp/

View File

@@ -0,0 +1,46 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ebs-loss-by-id-sa
namespace: default
labels:
name: ebs-loss-by-id-sa
app.kubernetes.io/part-of: litmus
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: ebs-loss-by-id-sa
labels:
name: ebs-loss-by-id-sa
app.kubernetes.io/part-of: litmus
rules:
- apiGroups: [""]
resources: ["pods","events","secrets"]
verbs: ["create","list","get","patch","update","delete","deletecollection"]
- apiGroups: [""]
resources: ["pods/exec","pods/log"]
verbs: ["create","list","get"]
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create","list","get","delete","deletecollection"]
- apiGroups: ["litmuschaos.io"]
resources: ["chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: ebs-loss-by-id-sa
labels:
name: ebs-loss-by-id-sa
app.kubernetes.io/part-of: litmus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ebs-loss-by-id-sa
subjects:
- kind: ServiceAccount
name: ebs-loss-by-id-sa
namespace: default