Added namespace mode chaos workflow for Hello World application to be triggered from litmus portal. (#341)
* added namespace mode chaos workflow sample for hello world app for portal Signed-off-by: ishangupta-ds <ishan.gupta@mayadata.io> * Added config map reference link. Signed-off-by: ishangupta-ds <ishan.gupta@mayadata.io>
This commit is contained in:
173
workflows/namespaced-scope-chaos/workflow.yaml
Normal file
173
workflows/namespaced-scope-chaos/workflow.yaml
Normal file
@@ -0,0 +1,173 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Workflow
|
||||
metadata:
|
||||
generateName: argowf-chaos-hello-world-pod-delete-
|
||||
spec:
|
||||
entrypoint: argowf-chaos
|
||||
serviceAccountName: argo-chaos
|
||||
arguments:
|
||||
parameters:
|
||||
- name: adminModeNamespace
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: litmus-portal-admin-config #This config map is created as a part of namespaced scope installation of litmus-portal, https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/namespaced-K8s-template.yml
|
||||
key: AgentNamespace
|
||||
templates:
|
||||
- name: argowf-chaos
|
||||
steps:
|
||||
- - name: install-experiment
|
||||
template: install-experiment
|
||||
- - name: run-chaos
|
||||
template: run-chaos
|
||||
- - name: revert-chaos
|
||||
template: revert-chaos
|
||||
|
||||
- name: install-experiment
|
||||
inputs:
|
||||
artifacts:
|
||||
- name: install-experiment
|
||||
path: /tmp/pod-delete.yaml
|
||||
raw:
|
||||
data: |
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
description:
|
||||
message: |
|
||||
Deletes a pod belonging to a deployment/statefulset/daemonset
|
||||
kind: ChaosExperiment
|
||||
metadata:
|
||||
name: pod-delete
|
||||
spec:
|
||||
definition:
|
||||
scope: Namespaced
|
||||
permissions:
|
||||
- apiGroups:
|
||||
- ""
|
||||
- "apps"
|
||||
- "batch"
|
||||
- "litmuschaos.io"
|
||||
resources:
|
||||
- "deployments"
|
||||
- "jobs"
|
||||
- "pods"
|
||||
- "pods/log"
|
||||
- "events"
|
||||
- "configmaps"
|
||||
- "chaosengines"
|
||||
- "chaosexperiments"
|
||||
- "chaosresults"
|
||||
verbs:
|
||||
- "create"
|
||||
- "list"
|
||||
- "get"
|
||||
- "patch"
|
||||
- "update"
|
||||
- "delete"
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- "nodes"
|
||||
verbs:
|
||||
- "get"
|
||||
- "list"
|
||||
image: "litmuschaos/go-runner:latest"
|
||||
imagePullPolicy: Always
|
||||
args:
|
||||
- -c
|
||||
- ./experiments/pod-delete
|
||||
command:
|
||||
- /bin/bash
|
||||
env:
|
||||
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: '15'
|
||||
|
||||
# Period to wait before and after injection of chaos in sec
|
||||
- name: RAMP_TIME
|
||||
value: ''
|
||||
|
||||
# provide the kill count
|
||||
- name: KILL_COUNT
|
||||
value: ''
|
||||
|
||||
- name: FORCE
|
||||
value: 'true'
|
||||
|
||||
- name: CHAOS_INTERVAL
|
||||
value: '5'
|
||||
|
||||
- name: LIB
|
||||
value: 'litmus'
|
||||
labels:
|
||||
name: pod-delete
|
||||
container:
|
||||
image: lachlanevenson/k8s-kubectl
|
||||
resources:
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 50m
|
||||
command: [sh, -c]
|
||||
args:
|
||||
[
|
||||
"kubectl apply -f /tmp/pod-delete.yaml -n {{workflow.parameters.adminModeNamespace}}",
|
||||
]
|
||||
|
||||
- name: run-chaos
|
||||
inputs:
|
||||
artifacts:
|
||||
- name: run-chaos
|
||||
path: /tmp/chaosengine.yaml
|
||||
raw:
|
||||
data: |
|
||||
apiVersion: litmuschaos.io/v1alpha1
|
||||
kind: ChaosEngine
|
||||
metadata:
|
||||
name: pod-delete-chaos
|
||||
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||
spec:
|
||||
appinfo:
|
||||
appns: {{workflow.parameters.adminModeNamespace}}
|
||||
applabel: 'app=hello-world'
|
||||
appkind: deployment
|
||||
jobCleanUpPolicy: retain
|
||||
monitoring: false
|
||||
annotationCheck: 'false'
|
||||
engineState: 'active'
|
||||
chaosServiceAccount: litmus-namespace-admin
|
||||
experiments:
|
||||
- name: pod-delete
|
||||
spec:
|
||||
components:
|
||||
resources:
|
||||
requests:
|
||||
memory: 128Mi
|
||||
cpu: 50m
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 50m
|
||||
env:
|
||||
- name: TOTAL_CHAOS_DURATION
|
||||
value: "30"
|
||||
- name: CHAOS_INTERVAL
|
||||
value: "10"
|
||||
- name: FORCE
|
||||
value: "false"
|
||||
container:
|
||||
image: litmuschaos/litmus-checker:latest
|
||||
resources:
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 50m
|
||||
args:
|
||||
- -file=/tmp/chaosengine.yaml
|
||||
- -saveName=/tmp/engine-name
|
||||
|
||||
- name: revert-chaos
|
||||
container:
|
||||
image: lachlanevenson/k8s-kubectl
|
||||
resources:
|
||||
limits:
|
||||
memory: 128Mi
|
||||
cpu: 50m
|
||||
command: [sh, -c]
|
||||
args:
|
||||
- "kubectl delete chaosengine pod-delete-chaos -n {{workflow.parameters.adminModeNamespace}}"
|
Reference in New Issue
Block a user