* Adding subject and label Signed-off-by: Oum Kale <oumkale@chaosnative.com> * updating context for infra level Signed-off-by: Oum Kale <oumkale@chaosnative.com> * updating chaosengine name Signed-off-by: Oum Kale <oumkale@chaosnative.com> * updating image to litmuschaos/k8s:latest Signed-off-by: Oum Kale <oumkale@chaosnative.com>
148 lines
5.3 KiB
YAML
148 lines
5.3 KiB
YAML
apiVersion: argoproj.io/v1alpha1
|
|
kind: CronWorkflow
|
|
metadata:
|
|
name: argo-chaos-node-memory-cron-wf
|
|
namespace: litmus
|
|
labels:
|
|
subject: "{{workflow.parameters.context}}"
|
|
spec:
|
|
schedule: "0 * * * *"
|
|
concurrencyPolicy: "Forbid"
|
|
startingDeadlineSeconds: 0
|
|
workflowSpec:
|
|
entrypoint: argowf-chaos
|
|
serviceAccountName: argo-chaos
|
|
securityContext:
|
|
runAsUser: 1000
|
|
runAsNonRoot: true
|
|
arguments:
|
|
parameters:
|
|
- name: adminModeNamespace
|
|
value: "litmus"
|
|
- name: context
|
|
value: "node-memory-hog_infra"
|
|
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 -name 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: litmuschaos/k8s:latest
|
|
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}}
|
|
labels:
|
|
context: "{{workflow.parameters.context}}"
|
|
spec:
|
|
jobCleanUpPolicy: retain
|
|
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: litmuschaos/k8s:latest
|
|
command: [sh, -c]
|
|
args:
|
|
[
|
|
"kubectl delete chaosengine kube-proxy-node-memory-hog-chaos -n {{workflow.parameters.adminModeNamespace}}",
|
|
] |