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:
VEDANT SHROTRIA
2020-10-06 13:38:08 +05:30
committed by GitHub
parent 544e800d53
commit b7179d2d22
7 changed files with 1002 additions and 1 deletions

View 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}}",
]