Added Workflows with Cron-Syntax for using in Litmus-portal. (#339)
* Added workflows with cron syntax Co-authored-by: Amit Kumar Das <amitkumar.das@mayadata.io> Signed-off-by: Vedant Shrotria <vedant.shrotria@mayadata.io>
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
## Refer to https://github.com/litmuschaos/chaos-workflows.git to setup the argo infrastructure
|
## Refer to https://github.com/litmuschaos/chaos-workflows.git to setup the argo infrastructure
|
||||||
## Uses admin mode of litmus execution
|
## Uses admin mode of litmus execution
|
||||||
|
|
||||||
|
|
||||||
apiVersion: argoproj.io/v1alpha1
|
apiVersion: argoproj.io/v1alpha1
|
||||||
kind: CronWorkflow
|
kind: CronWorkflow
|
||||||
metadata:
|
metadata:
|
||||||
|
233
workflows/kube-proxy-all/workflow_cron.yaml
Normal file
233
workflows/kube-proxy-all/workflow_cron.yaml
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: CronWorkflow
|
||||||
|
metadata:
|
||||||
|
name: argo-chaos-kube-proxy-cron-wf
|
||||||
|
namespace: litmus
|
||||||
|
spec:
|
||||||
|
schedule: "0 * * * *"
|
||||||
|
concurrencyPolicy: "Forbid"
|
||||||
|
startingDeadlineSeconds: 0
|
||||||
|
workflowSpec:
|
||||||
|
entrypoint: argowf-chaos
|
||||||
|
serviceAccountName: argo-chaos
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: adminModeNamespace
|
||||||
|
value: "litmus"
|
||||||
|
templates:
|
||||||
|
- name: argowf-chaos
|
||||||
|
steps:
|
||||||
|
- - name: install-chaos-experiments
|
||||||
|
template: install-chaos-experiments
|
||||||
|
- - name: node-cpu-hog
|
||||||
|
template: node-cpu-hog
|
||||||
|
- name: pod-memory-hog
|
||||||
|
template: pod-memory-hog
|
||||||
|
- - name: pod-cpu-hog
|
||||||
|
template: pod-cpu-hog
|
||||||
|
- name: node-memory-hog
|
||||||
|
template: node-memory-hog
|
||||||
|
- - name: pod-delete
|
||||||
|
template: pod-delete
|
||||||
|
- - name: revert-kube-proxy-chaos
|
||||||
|
template: revert-kube-proxy-chaos
|
||||||
|
|
||||||
|
- name: install-chaos-experiments
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
- "kubectl apply -f https://hub.litmuschaos.io/api/chaos/1.8.0?file=charts/generic/experiments.yaml -n
|
||||||
|
{{workflow.parameters.adminModeNamespace}} | sleep 30"
|
||||||
|
|
||||||
|
- name: node-cpu-hog
|
||||||
|
inputs:
|
||||||
|
artifacts:
|
||||||
|
- name: node-cpu-hog
|
||||||
|
path: /tmp/chaosengine-node-cpu-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
kind: ChaosEngine
|
||||||
|
metadata:
|
||||||
|
name: kube-proxy-node-cpu-hog
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: node-cpu-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
env:
|
||||||
|
- name: NODE_CPU_CORE
|
||||||
|
value: '1'
|
||||||
|
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine-node-cpu-hog.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: pod-memory-hog
|
||||||
|
inputs:
|
||||||
|
artifacts:
|
||||||
|
- name: pod-memory-hog
|
||||||
|
path: /tmp/chaosengine-pod-memory-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
kind: ChaosEngine
|
||||||
|
metadata:
|
||||||
|
name: kube-proxy-pod-memory-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: pod-memory-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
experimentImage: "litmuschaos/go-runner:ci"
|
||||||
|
env:
|
||||||
|
- name: TARGET_CONTAINER
|
||||||
|
value: 'kube-proxy'
|
||||||
|
- name: MEMORY_CONSUMPTION
|
||||||
|
value: '500'
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine-pod-memory-hog.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: pod-cpu-hog
|
||||||
|
inputs:
|
||||||
|
artifacts:
|
||||||
|
- name: pod-cpu-hog
|
||||||
|
path: /tmp/chaosengine-pod-cpu-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
kind: ChaosEngine
|
||||||
|
metadata:
|
||||||
|
name: kube-proxy-pod-cpu-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: pod-cpu-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
experimentImage: "litmuschaos/go-runner:ci"
|
||||||
|
env:
|
||||||
|
- name: TARGET_CONTAINER
|
||||||
|
value: 'kube-proxy'
|
||||||
|
- name: CPU_CORES
|
||||||
|
value: '1'
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine-pod-cpu-hog.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: node-memory-hog
|
||||||
|
inputs:
|
||||||
|
artifacts:
|
||||||
|
- name: node-memory-hog
|
||||||
|
path: /tmp/chaosengine-node-memory-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
kind: ChaosEngine
|
||||||
|
metadata:
|
||||||
|
name: kube-proxy-node-memory-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: node-memory-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
env:
|
||||||
|
- name: MEMORY_PERCENTAGE
|
||||||
|
value: '50'
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine-node-memory-hog.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: pod-delete
|
||||||
|
inputs:
|
||||||
|
artifacts:
|
||||||
|
- name: pod-delete
|
||||||
|
path: /tmp/chaosengine-pod-delete.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
kind: ChaosEngine
|
||||||
|
metadata:
|
||||||
|
name: kube-proxy-pod-delete-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: pod-delete
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
env:
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: "60"
|
||||||
|
- name: CHAOS_INTERVAL
|
||||||
|
value: "10"
|
||||||
|
- name: FORCE
|
||||||
|
value: "false"
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine-pod-delete.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: revert-kube-proxy-chaos
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
- "kubectl delete chaosengines --all -n
|
||||||
|
{{workflow.parameters.adminModeNamespace}}"
|
155
workflows/node-cpu-hog/workflow_cron.yaml
Normal file
155
workflows/node-cpu-hog/workflow_cron.yaml
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: CronWorkflow
|
||||||
|
metadata:
|
||||||
|
name: argo-chaos-node-cpu-cron-wf
|
||||||
|
namespace: litmus
|
||||||
|
spec:
|
||||||
|
schedule: "0 * * * *"
|
||||||
|
concurrencyPolicy: "Forbid"
|
||||||
|
startingDeadlineSeconds: 0
|
||||||
|
workflowSpec:
|
||||||
|
entrypoint: argowf-chaos
|
||||||
|
serviceAccountName: argo-chaos
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: adminModeNamespace
|
||||||
|
value: "litmus"
|
||||||
|
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/node-cpu-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
description:
|
||||||
|
message: |
|
||||||
|
Give a cpu spike on a node belonging to a deployment
|
||||||
|
kind: ChaosExperiment
|
||||||
|
metadata:
|
||||||
|
name: node-cpu-hog
|
||||||
|
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/go-runner:latest"
|
||||||
|
imagePullPolicy: Always
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- ./experiments/node-cpu-hog
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
env:
|
||||||
|
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60'
|
||||||
|
|
||||||
|
# Period to wait before and after injection of chaos in sec
|
||||||
|
- name: RAMP_TIME
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
## ENTER THE NUMBER OF CORES OF CPU FOR CPU HOGGING
|
||||||
|
## OPTIONAL VALUE IN CASE OF EMPTY VALUE IT WILL TAKE NODE CPU CAPACITY
|
||||||
|
- name: NODE_CPU_CORE
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
# PROVIDE THE LIB HERE
|
||||||
|
# ONLY LITMUS SUPPORTED
|
||||||
|
- name: LIB
|
||||||
|
value: 'litmus'
|
||||||
|
|
||||||
|
# provide lib image
|
||||||
|
- name: LIB_IMAGE
|
||||||
|
value: 'litmuschaos/go-runner:latest'
|
||||||
|
|
||||||
|
labels:
|
||||||
|
name: node-cpu-hog
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl apply -f /tmp/node-cpu-hog.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: kube-proxy-node-cpu-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: node-cpu-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
env:
|
||||||
|
- name: NODE_CPU_CORE
|
||||||
|
value: '1'
|
||||||
|
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: revert-chaos
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl delete chaosengine kube-proxy-node-cpu-hog-chaos -n {{workflow.parameters.adminModeNamespace}}",
|
||||||
|
]
|
145
workflows/node-memory-hog/workflow_cron.yaml
Normal file
145
workflows/node-memory-hog/workflow_cron.yaml
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: CronWorkflow
|
||||||
|
metadata:
|
||||||
|
name: argo-chaos-node-memory-cron-wf
|
||||||
|
namespace: litmus
|
||||||
|
spec:
|
||||||
|
schedule: "0 * * * *"
|
||||||
|
concurrencyPolicy: "Forbid"
|
||||||
|
startingDeadlineSeconds: 0
|
||||||
|
workflowSpec:
|
||||||
|
entrypoint: argowf-chaos
|
||||||
|
serviceAccountName: argo-chaos
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: adminModeNamespace
|
||||||
|
value: "litmus"
|
||||||
|
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/node-memory-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
description:
|
||||||
|
message: |
|
||||||
|
Give a memory hog on a node belonging to a deployment
|
||||||
|
kind: ChaosExperiment
|
||||||
|
metadata:
|
||||||
|
name: node-memory-hog
|
||||||
|
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/go-runner:latest"
|
||||||
|
imagePullPolicy: Always
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- ./experiments/node-memory-hog
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
env:
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '120'
|
||||||
|
## specify the size as percent of total available memory (in percentage)
|
||||||
|
## Default value "90"
|
||||||
|
- name: MEMORY_PERCENTAGE
|
||||||
|
value: '90'
|
||||||
|
# Period to wait before and after injection of chaos in sec
|
||||||
|
- name: RAMP_TIME
|
||||||
|
value: ''
|
||||||
|
# Provide the LIB here
|
||||||
|
# Only litmus supported
|
||||||
|
- name: LIB
|
||||||
|
value: 'litmus'
|
||||||
|
# provide lib image
|
||||||
|
- name: LIB_IMAGE
|
||||||
|
value: 'litmuschaos/go-runner:latest'
|
||||||
|
labels:
|
||||||
|
name: node-memory-hog
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl apply -f /tmp/node-memory-hog.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: kube-proxy-node-memory-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: node-memory-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
env:
|
||||||
|
- name: MEMORY_PERCENTAGE
|
||||||
|
value: '50'
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
- name: revert-chaos
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl delete chaosengine kube-proxy-node-memory-hog-chaos -n {{workflow.parameters.adminModeNamespace}}",
|
||||||
|
]
|
156
workflows/pod-cpu-hog/workflow_cron.yaml
Normal file
156
workflows/pod-cpu-hog/workflow_cron.yaml
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: CronWorkflow
|
||||||
|
metadata:
|
||||||
|
name: argo-chaos-pod-cpu-cron-wf
|
||||||
|
namespace: litmus
|
||||||
|
spec:
|
||||||
|
schedule: "0 * * * *"
|
||||||
|
concurrencyPolicy: "Forbid"
|
||||||
|
startingDeadlineSeconds: 0
|
||||||
|
workflowSpec:
|
||||||
|
entrypoint: argowf-chaos
|
||||||
|
serviceAccountName: argo-chaos
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: adminModeNamespace
|
||||||
|
value: "litmus"
|
||||||
|
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-cpu-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
description:
|
||||||
|
message: |
|
||||||
|
Injects cpu consumption on pods belonging to an app deployment
|
||||||
|
kind: ChaosExperiment
|
||||||
|
metadata:
|
||||||
|
name: pod-cpu-hog
|
||||||
|
spec:
|
||||||
|
definition:
|
||||||
|
scope: Namespaced
|
||||||
|
permissions:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
- "batch"
|
||||||
|
- "litmuschaos.io"
|
||||||
|
resources:
|
||||||
|
- "jobs"
|
||||||
|
- "pods"
|
||||||
|
- "pods/log"
|
||||||
|
- "events"
|
||||||
|
- "chaosengines"
|
||||||
|
- "chaosexperiments"
|
||||||
|
- "chaosresults"
|
||||||
|
verbs:
|
||||||
|
- "create"
|
||||||
|
- "list"
|
||||||
|
- "get"
|
||||||
|
- "patch"
|
||||||
|
- "update"
|
||||||
|
- "delete"
|
||||||
|
image: "litmuschaos/go-runner:ci"
|
||||||
|
imagePullPolicy: Always
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- ./experiments/pod-cpu-hog
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
env:
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '30'
|
||||||
|
|
||||||
|
- name: CHAOS_INTERVAL
|
||||||
|
value: '10'
|
||||||
|
|
||||||
|
## Number of CPU cores to stress
|
||||||
|
- name: CPU_CORES
|
||||||
|
value: '1'
|
||||||
|
|
||||||
|
## Percentage of total pods to target
|
||||||
|
- name: PODS_AFFECTED_PERC
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
## Period to wait before and after injection of chaos in sec
|
||||||
|
- name: RAMP_TIME
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
- name: LIB
|
||||||
|
value: 'litmus'
|
||||||
|
|
||||||
|
- name: TARGET_POD
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
labels:
|
||||||
|
name: pod-cpu-hog
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl apply -f /tmp/pod-cpu-hog.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: kube-proxy-pod-cpu-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: pod-cpu-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
experimentImage: "litmuschaos/go-runner:ci"
|
||||||
|
env:
|
||||||
|
- name: TARGET_CONTAINER
|
||||||
|
value: 'kube-proxy'
|
||||||
|
|
||||||
|
- name: CPU_CORES
|
||||||
|
value: '1'
|
||||||
|
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
|
||||||
|
- name: CHAOS_KILL_COMMAND
|
||||||
|
value: "kill -9 $(ps afx | grep \"[md5sum] /dev/zero\" | awk '{print$1}' | tr '\n' ' ')"
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: revert-chaos
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl delete chaosengine kube-proxy-pod-cpu-hog-chaos -n {{workflow.parameters.adminModeNamespace}}",
|
||||||
|
]
|
156
workflows/pod-delete/workflow_cron.yaml
Normal file
156
workflows/pod-delete/workflow_cron.yaml
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: CronWorkflow
|
||||||
|
metadata:
|
||||||
|
name: argo-chaos-pod-delete-cron-wf
|
||||||
|
namespace: litmus
|
||||||
|
spec:
|
||||||
|
schedule: "0 * * * *"
|
||||||
|
concurrencyPolicy: "Forbid"
|
||||||
|
startingDeadlineSeconds: 0
|
||||||
|
workflowSpec:
|
||||||
|
entrypoint: argowf-chaos
|
||||||
|
serviceAccountName: argo-chaos
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: adminModeNamespace
|
||||||
|
value: "litmus"
|
||||||
|
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
|
||||||
|
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: kube-proxy-pod-delete-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: pod-delete
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
env:
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: "60"
|
||||||
|
- name: CHAOS_INTERVAL
|
||||||
|
value: "10"
|
||||||
|
- name: FORCE
|
||||||
|
value: "false"
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: revert-chaos
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl delete chaosengine kube-proxy-pod-delete-chaos -n {{workflow.parameters.adminModeNamespace}}",
|
||||||
|
]
|
157
workflows/pod-memory-hog/workflow_cron.yaml
Normal file
157
workflows/pod-memory-hog/workflow_cron.yaml
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
apiVersion: argoproj.io/v1alpha1
|
||||||
|
kind: CronWorkflow
|
||||||
|
metadata:
|
||||||
|
name: argo-chaos-pod-memory-cron-wf
|
||||||
|
namespace: litmus
|
||||||
|
spec:
|
||||||
|
schedule: "0 * * * *"
|
||||||
|
concurrencyPolicy: "Forbid"
|
||||||
|
startingDeadlineSeconds: 0
|
||||||
|
workflowSpec:
|
||||||
|
entrypoint: argowf-chaos
|
||||||
|
serviceAccountName: argo-chaos
|
||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
- name: adminModeNamespace
|
||||||
|
value: "litmus"
|
||||||
|
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-memory-hog.yaml
|
||||||
|
raw:
|
||||||
|
data: |
|
||||||
|
apiVersion: litmuschaos.io/v1alpha1
|
||||||
|
description:
|
||||||
|
message: |
|
||||||
|
Injects memory consumption on pods belonging to an app deployment
|
||||||
|
kind: ChaosExperiment
|
||||||
|
metadata:
|
||||||
|
name: pod-memory-hog
|
||||||
|
spec:
|
||||||
|
definition:
|
||||||
|
scope: Namespaced
|
||||||
|
permissions:
|
||||||
|
- apiGroups:
|
||||||
|
- ""
|
||||||
|
- "batch"
|
||||||
|
- "litmuschaos.io"
|
||||||
|
resources:
|
||||||
|
- "jobs"
|
||||||
|
- "pods"
|
||||||
|
- "pods/log"
|
||||||
|
- "events"
|
||||||
|
- "chaosengines"
|
||||||
|
- "chaosexperiments"
|
||||||
|
- "chaosresults"
|
||||||
|
verbs:
|
||||||
|
- "create"
|
||||||
|
- "list"
|
||||||
|
- "get"
|
||||||
|
- "patch"
|
||||||
|
- "update"
|
||||||
|
- "delete"
|
||||||
|
image: "litmuschaos/go-runner:latest"
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- ./experiments/pod-memory-hog
|
||||||
|
command:
|
||||||
|
- /bin/bash
|
||||||
|
env:
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '30'
|
||||||
|
|
||||||
|
- name: CHAOS_INTERVAL
|
||||||
|
value: '10'
|
||||||
|
|
||||||
|
## enter the amount of memory in megabytes to be consumed by the application pod
|
||||||
|
- name: MEMORY_CONSUMPTION
|
||||||
|
value: '500'
|
||||||
|
|
||||||
|
## percentage of total pods to target
|
||||||
|
- name: PODS_AFFECTED_PERC
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
## Period to wait before and after injection of chaos in sec
|
||||||
|
- name: RAMP_TIME
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
## env var that describes the library used to execute the chaos
|
||||||
|
## default: litmus. Supported values: litmus, powerfulseal, chaoskube
|
||||||
|
- name: LIB
|
||||||
|
value: 'litmus'
|
||||||
|
|
||||||
|
- name: TARGET_POD
|
||||||
|
value: ''
|
||||||
|
|
||||||
|
labels:
|
||||||
|
name: pod-memory-hog
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl apply -f /tmp/pod-memory-hog.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: kube-proxy-pod-memory-hog-chaos
|
||||||
|
namespace: {{workflow.parameters.adminModeNamespace}}
|
||||||
|
spec:
|
||||||
|
appinfo:
|
||||||
|
appns: kube-system
|
||||||
|
applabel: "k8s-app=kube-proxy"
|
||||||
|
appkind: daemonset
|
||||||
|
jobCleanUpPolicy: retain
|
||||||
|
monitoring: false
|
||||||
|
annotationCheck: 'false'
|
||||||
|
engineState: 'active'
|
||||||
|
chaosServiceAccount: litmus-admin
|
||||||
|
experiments:
|
||||||
|
- name: pod-memory-hog
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
experimentImage: "litmuschaos/go-runner:ci"
|
||||||
|
env:
|
||||||
|
- name: TARGET_CONTAINER
|
||||||
|
value: 'kube-proxy'
|
||||||
|
|
||||||
|
- name: MEMORY_CONSUMPTION
|
||||||
|
value: '500'
|
||||||
|
|
||||||
|
- name: TOTAL_CHAOS_DURATION
|
||||||
|
value: '60' # in seconds
|
||||||
|
|
||||||
|
- name: CHAOS_KILL_COMMAND
|
||||||
|
value: "kill -9 $(ps afx | grep \"[dd] if /dev/zero\" | awk '{print $1}' | tr '\n' ' ')"
|
||||||
|
container:
|
||||||
|
image: litmuschaos/litmus-checker:latest
|
||||||
|
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
|
||||||
|
|
||||||
|
- name: revert-chaos
|
||||||
|
container:
|
||||||
|
image: lachlanevenson/k8s-kubectl
|
||||||
|
command: [sh, -c]
|
||||||
|
args:
|
||||||
|
[
|
||||||
|
"kubectl delete chaosengine kube-proxy-pod-memory-hog-chaos -n {{workflow.parameters.adminModeNamespace}}",
|
||||||
|
]
|
Reference in New Issue
Block a user