chore(charts): Restructuring and some minor fixes (#298)

Signed-off-by: Udit Gaurav <uditgaurav@gmail.com>
This commit is contained in:
UDIT GAURAV
2020-08-20 20:36:21 +05:30
committed by GitHub
parent bcaafdb134
commit d349658564
25 changed files with 80 additions and 223 deletions

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,20 @@
# Pre-requisite
_In Namespace Changes_
- This experiment assume that you are using AWS with kubernetes
- This experiment assume your namespace has right role for aws to make aws api calls
- This experiment also assume you are using Instance group for your name space or aware that if you are using share node group, it will impact other pods running on this ec2 instance
# Procedure
- Apply experiments for k8 - `kubectl apply -f experiments.yaml`
- Validate the experiments for k8 - `kubectl get chaosexperiment`
- Setup RBAC - for pod delete RBAC - `kubectl apply -f rbac.yaml`
- Create pod Experiment - for health experiment -`kubectl create -f engine.yaml`
- Validate experiment - `kubectl get pods -o wide`
- Validate logs - `kubectl logs -f <delete pod>`
- Clean up chaosexperiment -`kubectl delete -f engine.yaml`
- Clean up rbac -`kubectl delete -f rbac.yaml`

View File

@@ -0,0 +1,52 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: aws-ec2-terminate
namespace: default
spec:
appinfo:
appns: 'default'
applabel: 'app=nginx'
appkind: 'deployment'
annotationCheck: 'false'
engineState: 'active'
monitoring: false
jobCleanUpPolicy: 'retain'
chaosServiceAccount: chaos-admin
components:
runner:
runnerannotation:
iam.amazonaws.com/role: "k8s-chaosec2access"
experiments:
- name: aws-ec2-terminate
spec:
components:
experimentannotation:
iam.amazonaws.com/role: "k8s-chaosec2access"
env:
- name: NAME_SPACE
value: default
- name: LABEL_NAME
value: app=nginx
- name: APP_ENDPOINT
value: localhost
- name: FILE
value: 'ec2-delete.json'
- name: AWS_ROLE
value: 'chaosec2access'
- name: AWS_ACCOUNT
value: '0000000000'
- name: AWS_REGION
value: 'us-west-2'
- name: AWS_AZ
value: 'us-west-2c'
- name: AWS_RESOURCE
value: 'ec2-iks'
- name: AWS_SSL
value: 'false'
- name: REPORT
value: 'true'
- name: REPORT_ENDPOINT
value: 'none'
- name: TEST_NAMESPACE
value: 'default'

View File

@@ -0,0 +1,105 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Deletes an aws instance belonging to a deployment/statefulset/daemonset
kind: ChaosExperiment
metadata:
name: aws-ec2-terminate
version: 0.0.1
spec:
definition:
scope: Namespaced
permissions:
- apiGroups:
- ""
- "apps"
- "batch"
- "litmuschaos.io"
resources:
- "deployments"
- "jobs"
- "pods"
- "configmaps"
- "chaosengines"
- "chaosexperiments"
- "chaosresults"
verbs:
- "create"
- "list"
- "get"
- "patch"
- "update"
- "delete"
- apiGroups:
- ""
resources:
- "nodes"
verbs :
- "get"
- "list"
image: "litmuschaos/chaostoolkit:latest"
args:
- -c
- python /app/chaos/chaostest/aws/aws_wrapper.py ; exit 0
command:
- /bin/bash
env:
- name: CHAOSTOOLKIT_IN_POD
value: 'true'
- name: FILE
value: 'ec2-delete.json'
- name: NAME_SPACE
value: 'default'
- name: LABEL_NAME
value: 'app=nginx'
- name: APP_ENDPOINT
value: 'localhost'
# Period to wait before injection of chaos in sec
- name: PERCENTAGE
value: '50'
# Variable to set for custom report upload
- name: REPORT
value: 'false'
# Variable to set for report upload endpoint
- name: REPORT_ENDPOINT
value: 'none'
# Variable to set for AWS account
- name: AWS_ACCOUNT
value: '000000000000'
# Variable to set for AWS role, Make sure you have created this role and have give access
- name: AWS_ROLE
value: 'chaosec2access'
# Variable to set for AWS region
- name: AWS_REGION
value: 'us-west-2'
# Variable to set for AWS AZ
- name: AWS_AZ
value: 'us-west-2c'
# Variable to set for AWS RESOURCE
- name: AWS_RESOURCE
value: 'ec2-iks'
# Variable to set for AWS SSL
- name: AWS_SSL
value: 'false'
# Variable which indicates where the test results CRs will be persisted
- name: TEST_NAMESPACE
value: 'default'
labels:
name: aws-ec2-terminate

View File

@@ -0,0 +1,35 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
name: k8-aws-ec2-terminate
version: 0.0.1
annotations:
categories: Kubernetes
vendor: CNCF
createdAt: 2020-02-24T10:28:08Z
support: https://slack.kubernetes.io/
spec:
displayName: k8-aws-ec2-terminate
categoryDescription: |
AWS EC2 terminate contains chaos to disrupt state of aws resources running part of kuberntes cluster workload. It uses chaostoolkit to inject ec2 instance termination against a specified applications
keywords:
- Kubernetes
- AWS
- EC2
- State
platforms:
- Minikube
maturity: alpha
maintainers:
- name: sumit
email: sumit_nagal@intuit.com
minKubeVersion: 1.12.0
provider:
name: Intuit
links:
- name: Source Code
url: https://github.com/litmuschaos/litmus-python/tree/master/chaos-test
icon:
- url:
mediatype: ""
chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/kube-aws/k8-aws-ec2-terminate/experiment.yaml

View File

@@ -0,0 +1,35 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: chaos-admin
labels:
name: chaos-admin
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: chaos-admin
labels:
name: chaos-admin
rules:
- apiGroups: ["","apps","batch","extensions","litmuschaos.io","openebs.io","storage.k8s.io"]
resources: ["chaosengines","chaosexperiments","chaosresults","configmaps","cstorpools","cstorvolumereplicas","events","jobs","persistentvolumeclaims","persistentvolumes","pods","pods/exec","pods/log","secrets","storageclasses","chaosengines","chaosexperiments","chaosresults","configmaps","cstorpools","cstorvolumereplicas","daemonsets","deployments","events","jobs","persistentvolumeclaims","persistentvolumes","pods","pods/eviction","pods/exec","pods/log","replicasets","secrets","services","statefulsets","storageclasses"]
verbs: ["create","delete","get","list","patch","update"]
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get","list","patch"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: chaos-admin
labels:
name: chaos-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: chaos-admin
subjects:
- kind: ServiceAccount
name: chaos-admin
namespace: default

View File

@@ -0,0 +1,39 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
createdAt: 2019-09-26T10:28:08Z
name: kube-aws
version: 0.1.16
annotations:
categories: Kubernetes
chartDescription: Injects kube-aws kubernetes chaos
spec:
displayName: Kube AWS
categoryDescription: >
kube-aws contains chaos to disrupt state of aws resources running part of kubernetes cluster
experiments:
- k8-aws-ec2-terminate
keywords:
- AWS
- EC2
- State
maintainers:
- name: sumit
email: sumit_nagal@intuit.com
minKubeVersion: 1.12.0
provider:
name: Intuit
links:
- name: Kubernetes Website
url: https://kubernetes.io
- name: Source Code
url: https://github.com/litmuschaos/litmus-python/tree/master/chaos-test
- name: Kubernetes Slack
url: https://slack.kubernetes.io/
- name: Documentation
url:
icon:
- url:
mediatype: image/png
chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/litmus-python/tree/master/chaos-test

View File

@@ -0,0 +1,6 @@
packageName: kube-aws
experiments:
- name: k8-aws-ec2-terminate
CSV: k8-aws-ec2-terminate.chartserviceversion.yaml
desc: "k8-aws-ec2-terminate"