Files
litmus-hub/workflows/sock-shop-demo/usingCmdProbe/workflow_cron.yaml
OUM NIVRATHI KALE df11ea13fe update installation of experiment (#419)
Signed-off-by: oumkale <oum.kale@mayadata.io>
2021-03-05 20:36:09 +05:30

373 lines
15 KiB
YAML

apiVersion: argoproj.io/v1alpha1
kind: CronWorkflow
metadata:
generateName: argowf-chaos-sock-shop-resiliency-cron-wf-
namespace: litmus
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"
templates:
- name: argowf-chaos
steps:
- - name: install-application
template: install-application
- - name: install-chaos-experiments
template: install-chaos-experiments
- name: load-test
template: load-test
- - name: pod-memory-hog
template: pod-memory-hog
- name: pod-cpu-hog
template: pod-cpu-hog
- - name: pod-delete
template: pod-delete
- - name: pod-network-loss
template: pod-network-loss
- - name: revert-chaos
template: revert-chaos
# - name: delete-application
# template: delete-application
- name: delete-loadtest
template: delete-loadtest
- name: install-application
container:
image: litmuschaos/litmus-app-deployer:latest
args: ["-namespace=sock-shop","-typeName=resilient","-operation=apply","-timeout=400"]
- name: install-chaos-experiments
container:
image: alpine/k8s:1.18.2
command: [sh, -c]
args:
- "kubectl apply -f https://hub.litmuschaos.io/api/chaos/master?file=charts/generic/experiments.yaml -n
{{workflow.parameters.adminModeNamespace}} | sleep 30"
- name: pod-cpu-hog
inputs:
artifacts:
- name: pod-cpu-hog
path: /tmp/chaosengine.yaml
raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: pod-cpu-hog-chaos
namespace: {{workflow.parameters.adminModeNamespace}}
spec:
appinfo:
appns: 'sock-shop'
applabel: 'name=carts'
appkind: 'deployment'
jobCleanUpPolicy: retain
monitoring: false
annotationCheck: 'false'
engineState: 'active'
chaosServiceAccount: litmus-admin
experiments:
- name: pod-cpu-hog
spec:
probe:
- name: "check-frontend-access-url"
type: "httpProbe"
httpProbe/inputs:
url: "http://front-end.sock-shop.svc.cluster.local:80"
insecureSkipVerify: false
method:
get:
criteria: "=="
responseCode: "200"
mode: "Continuous"
runProperties:
probeTimeout: 2
interval: 1
retry: 1
probePollingInterval: 1
- name: "check-benchmark"
type: "cmdProbe"
cmdProbe/inputs:
command: "curl http://qps-test.sock-shop.svc.cluster.local"
comparator:
type: "int" # supports: string, int, float
criteria: ">=" #supports >=,<=,>,<,==,!= for int and contains,equal,notEqual,matches,notMatches for string values
value: "500"
source: "inline" # it can be “inline” or any image
mode: "Edge"
runProperties:
probeTimeout: 2
interval: 2
retry: 1
initialDelaySeconds: 10
components:
experimentImage: "litmuschaos/go-runner:latest"
env:
#number of cpu cores to be consumed
#verify the resources the app has been launched with
- name: CPU_CORES
value: '1'
- name: TOTAL_CHAOS_DURATION
value: '30' # 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: pod-memory-hog
inputs:
artifacts:
- name: pod-memory-hog
path: /tmp/chaosengine.yaml
raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: pod-memory-hog-chaos
namespace: {{workflow.parameters.adminModeNamespace}}
spec:
appinfo:
appns: 'sock-shop'
applabel: 'name=orders'
appkind: 'deployment'
jobCleanUpPolicy: retain
monitoring: false
annotationCheck: 'false'
engineState: 'active'
chaosServiceAccount: litmus-admin
experiments:
- name: pod-memory-hog
spec:
probe:
- name: "check-frontend-access-url"
type: "httpProbe"
httpProbe/inputs:
url: "http://front-end.sock-shop.svc.cluster.local:80"
insecureSkipVerify: false
method:
get:
criteria: "=="
responseCode: "200"
mode: "Continuous"
runProperties:
probeTimeout: 2
interval: 1
retry: 1
probePollingInterval: 1
- name: "check-benchmark"
type: "cmdProbe"
cmdProbe/inputs:
command: "curl http://qps-test.sock-shop.svc.cluster.local"
comparator:
type: "int" # supports: string, int, float
criteria: ">=" #supports >=,<=,>,<,==,!= for int and contains,equal,notEqual,matches,notMatches for string values
value: "500"
source: "inline" # it can be “inline” or any image
mode: "Edge"
runProperties:
probeTimeout: 2
interval: 2
retry: 1
initialDelaySeconds: 10
components:
experimentImage: "litmuschaos/go-runner:latest"
env:
- name: MEMORY_CONSUMPTION
value: '500'
- name: TOTAL_CHAOS_DURATION
value: '30' # 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: pod-delete
inputs:
artifacts:
- name: pod-delete
path: /tmp/chaosengine.yaml
raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: catalogue-pod-delete-chaos
namespace: {{workflow.parameters.adminModeNamespace}}
spec:
appinfo:
appns: 'sock-shop'
applabel: 'name=catalogue'
appkind: 'deployment'
annotationCheck: 'false'
engineState: 'active'
chaosServiceAccount: litmus-admin
monitoring: true
jobCleanUpPolicy: 'retain'
components:
runner:
imagePullPolicy: Always
experiments:
- name: pod-delete
spec:
probe:
- name: "check-catalogue-access-url"
type: "httpProbe"
httpProbe/inputs:
url: "http://front-end.sock-shop.svc.cluster.local:80/catalogue"
insecureSkipVerify: false
method:
get:
criteria: "=="
responseCode: "200"
mode: "Continuous"
runProperties:
probeTimeout: 2
interval: 1
retry: 1
probePollingInterval: 1
- name: "check-benchmark"
type: "cmdProbe"
cmdProbe/inputs:
command: "curl http://qps-test.sock-shop.svc.cluster.local"
comparator:
type: "int" # supports: string, int, float
criteria: ">=" #supports >=,<=,>,<,==,!= for int and contains,equal,notEqual,matches,notMatches for string values
value: "500"
source: "inline" # it can be “inline” or any image
mode: "Edge"
runProperties:
probeTimeout: 2
interval: 2
retry: 1
initialDelaySeconds: 2
components:
env:
- name: TOTAL_CHAOS_DURATION
value: '30'
# set chaos interval (in sec) as desired
- name: CHAOS_INTERVAL
value: '10'
# pod failures without '--force' & default terminationGracePeriodSeconds
- name: FORCE
value: 'false'
container:
image: litmuschaos/litmus-checker:latest
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
- name: pod-network-loss
inputs:
artifacts:
- name: pod-network-loss
path: /tmp/chaosengine.yaml
raw:
data: |
apiVersion: litmuschaos.io/v1alpha1
kind: ChaosEngine
metadata:
name: pod-network-loss-chaos
namespace: {{workflow.parameters.adminModeNamespace}}
spec:
appinfo:
appns: 'sock-shop'
applabel: 'name=user-db'
appkind: 'statefulset'
jobCleanUpPolicy: retain
monitoring: false
annotationCheck: 'false'
engineState: 'active'
chaosServiceAccount: litmus-admin
components:
runner:
imagePullPolicy: Always
experiments:
- name: pod-network-loss
spec:
probe:
- name: "check-cards-access-url"
type: "httpProbe"
httpProbe/inputs:
url: "http://front-end.sock-shop.svc.cluster.local:80/cards"
insecureSkipVerify: false
method:
get:
criteria: "=="
responseCode: "200"
mode: "Continuous"
runProperties:
probeTimeout: 2
interval: 1
retry: 2
probePollingInterval: 1
- name: "check-benchmark"
type: "cmdProbe"
cmdProbe/inputs:
command: "curl http://qps-test.sock-shop.svc.cluster.local"
comparator:
type: "int" # supports: string, int, float
criteria: ">=" #supports >=,<=,>,<,==,!= for int and contains,equal,notEqual,matches,notMatches for string values
value: "500"
source: "inline" # it can be “inline” or any image
mode: "Edge"
runProperties:
probeTimeout: 2
interval: 2
retry: 1
initialDelaySeconds: 2
components:
env:
- name: TOTAL_CHAOS_DURATION
value: '30'
- name: NETWORK_INTERFACE
value: 'eth0'
- name: NETWORK_PACKET_LOSS_PERCENTAGE
value: '100'
- name: CONTAINER_RUNTIME
value: 'docker'
- name: SOCKET_PATH
value: '/var/run/docker.sock'
container:
image: litmuschaos/litmus-checker:latest
args: ["-file=/tmp/chaosengine.yaml","-saveName=/tmp/engine-name"]
- name: delete-application
container:
image: litmuschaos/litmus-app-deployer:latest
args: ["-namespace=sock-shop","-typeName=resilient","-operation=delete"]
- name: load-test
container:
image: litmuschaos/litmus-app-deployer:latest
args: ["-namespace=loadtest"]
- name: delete-loadtest
container:
image: litmuschaos/litmus-app-deployer:latest
args: ["-namespace=loadtest","-operation=delete"]
- name: revert-chaos
container:
image: alpine/k8s:1.18.2
command: [sh, -c]
args:
[
"kubectl delete chaosengine pod-memory-hog-chaos pod-cpu-hog-chaos catalogue-pod-delete-chaos pod-network-loss-chaos -n {{workflow.parameters.adminModeNamespace}}",
]