Directory restructure to add scenarios and experiments (#559)

* Updated dir struture with scenarios and experiments dir

Signed-off-by: Amit Kumar Das <amit.das@harness.io>

* Added icons

Signed-off-by: Amit Kumar Das <amit.das@harness.io>
This commit is contained in:
Amit Kumar Das
2022-07-15 17:30:39 +05:30
committed by GitHub
parent 15a0ec5d48
commit 7adf5d35a1
382 changed files with 24112 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: nginx-network-chaos
namespace: default
spec:
# It can be active/stop
engineState: 'active'
appinfo:
appns: 'default'
# FYI, To see app label, apply kubectl get pods --show-labels
applabel: 'app=nginx'
appkind: 'deployment'
chaosServiceAccount: pod-network-partition-sa
experiments:
- name: pod-network-partition
spec:
components:
env:
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds

View File

@@ -0,0 +1,100 @@
apiVersion: litmuschaos.io/v1alpha1
description:
message: |
Injects 100% network packet loss on pods belonging to an app deployment
kind: ChaosExperiment
metadata:
name: pod-network-partition
labels:
name: pod-network-partition
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: chaosexperiment
app.kubernetes.io/version: latest
spec:
definition:
scope: Namespaced
permissions:
# Create and monitor the experiment & helper pods
- apiGroups: [""]
resources: ["pods"]
verbs: ["create","delete","get","list","patch","update", "deletecollection"]
# Performs CRUD operations on the events inside chaosengine and chaosresult
- apiGroups: [""]
resources: ["events"]
verbs: ["create","get","list","patch","update"]
# Fetch configmaps details and mount it to the experiment pod (if specified)
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get","list",]
# Track and get the runner, experiment, and helper pods log
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get","list","watch"]
# for creating and managing to execute comands inside target container
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get","list","create"]
# for configuring and monitor the experiment job by the chaos-runner pod
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create","list","get","delete","deletecollection"]
# performs CRUD operations on the network policies
- apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
verbs: ["create","delete","list","get"]
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
- apiGroups: ["litmuschaos.io"]
resources: ["chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update","delete"]
image: "litmuschaos/go-runner:latest"
imagePullPolicy: Always
args:
- -c
- ./experiments -name pod-network-partition
command:
- /bin/bash
env:
- name: TOTAL_CHAOS_DURATION
value: '60' # in seconds
# ime period to wait before and after injection of chaos in sec
- name: RAMP_TIME
value: ''
# it should be litmus
- name: LIB
value: 'litmus'
# provide the destination ips
# chaos injection will be triggered for these destination ips
- name: DESTINATION_IPS
value: ''
# provide the destination hosts
# chaos injection will be triggered for these destination hosts
- name: DESTINATION_HOSTS
value: ''
# provide network policy type
# support ingress, egress, all values
- name: POLICY_TYPES
value: 'all'
# provide labels of the destination pods
- name: POD_SELECTOR
value: ''
# provide labels the destination namespaces
- name: NAMESPACE_SELECTOR
value: ''
# provide comma separated ports
- name: PORTS
value: ''
labels:
name: pod-network-partition
app.kubernetes.io/part-of: litmus
app.kubernetes.io/component: experiment-job
app.kubernetes.io/version: latest

View File

@@ -0,0 +1,43 @@
apiVersion: litmuchaos.io/v1alpha1
kind: ChartServiceVersion
metadata:
createdAt: 2021-08-25T10:28:08Z
name: pod-network-partition
version: 0.1.0
annotations:
categories: Kubernetes
vendor: CNCF
support: https://slack.kubernetes.io/
spec:
displayName: pod-network-partition
categoryDescription: |
pod-network-partition contains chaos to disrupt network connectivity to kubernetes pods. Experiments can inject complete egress/ingress network loss based on label and namespace selectors.
- The application pod should be healthy once chaos is stopped. Service-requests should be served (say, via alternate replicas) despite chaos.
keywords:
- Kubernetes
- K8S
- Pod
- Network
- Partition
platforms:
- Minikube
- Packet(Kubeadm)
maturity: alpha
maintainers:
- name: ispeakc0de
email: shubham@chaosnative.com
minKubeVersion: 1.12.0
provider:
name: ChaosNative
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/generic/pod-network-partition
- name: Documentation
url: https://litmuschaos.github.io/litmus/experiments/categories/pods/pod-network-partition/
icon:
- base64data: ""
mediatype: ""
chaosexpcrdlink: https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/pod-network-partition/experiment.yaml

View File

@@ -0,0 +1,72 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-network-partition-sa
namespace: default
labels:
name: pod-network-partition-sa
app.kubernetes.io/part-of: litmus
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-network-partition-sa
namespace: default
labels:
name: pod-network-partition-sa
app.kubernetes.io/part-of: litmus
rules:
# Create and monitor the experiment & helper pods
- apiGroups: [""]
resources: ["pods"]
verbs: ["create","delete","get","list","patch","update", "deletecollection"]
# Performs CRUD operations on the events inside chaosengine and chaosresult
- apiGroups: [""]
resources: ["events"]
verbs: ["create","get","list","patch","update"]
# Fetch configmaps details and mount it to the experiment pod (if specified)
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get","list",]
# Track and get the runner, experiment, and helper pods log
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get","list","watch"]
# for creating and managing to execute comands inside target container
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get","list","create"]
# for configuring and monitor the experiment job by the chaos-runner pod
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create","list","get","delete","deletecollection"]
# performs CRUD operations on the network policies
- apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
verbs: ["create","delete","list","get"]
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
- apiGroups: ["litmuschaos.io"]
resources: ["chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update","delete"]
# use litmus psp
- apiGroups: ["policy"]
resources: ["podsecuritypolicies"]
verbs: ["use"]
resourceNames: ["litmus"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-network-partition-sa
namespace: default
labels:
name: pod-network-partition-sa
app.kubernetes.io/part-of: litmus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-network-partition-sa
subjects:
- kind: ServiceAccount
name: pod-network-partition-sa
namespace: default

View File

@@ -0,0 +1,67 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-network-partition-sa
namespace: default
labels:
name: pod-network-partition-sa
app.kubernetes.io/part-of: litmus
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-network-partition-sa
namespace: default
labels:
name: pod-network-partition-sa
app.kubernetes.io/part-of: litmus
rules:
# Create and monitor the experiment & helper pods
- apiGroups: [""]
resources: ["pods"]
verbs: ["create","delete","get","list","patch","update", "deletecollection"]
# Performs CRUD operations on the events inside chaosengine and chaosresult
- apiGroups: [""]
resources: ["events"]
verbs: ["create","get","list","patch","update"]
# Fetch configmaps details and mount it to the experiment pod (if specified)
- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get","list",]
# Track and get the runner, experiment, and helper pods log
- apiGroups: [""]
resources: ["pods/log"]
verbs: ["get","list","watch"]
# for creating and managing to execute comands inside target container
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["get","list","create"]
# for configuring and monitor the experiment job by the chaos-runner pod
- apiGroups: ["batch"]
resources: ["jobs"]
verbs: ["create","list","get","delete","deletecollection"]
# performs CRUD operations on the network policies
- apiGroups: ["networking.k8s.io"]
resources: ["networkpolicies"]
verbs: ["create","delete","list","get"]
# for creation, status polling and deletion of litmus chaos resources used within a chaos workflow
- apiGroups: ["litmuschaos.io"]
resources: ["chaosengines","chaosexperiments","chaosresults"]
verbs: ["create","list","get","patch","update","delete"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: pod-network-partition-sa
namespace: default
labels:
name: pod-network-partition-sa
app.kubernetes.io/part-of: litmus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: pod-network-partition-sa
subjects:
- kind: ServiceAccount
name: pod-network-partition-sa
namespace: default