133 lines
4.6 KiB
YAML
133 lines
4.6 KiB
YAML
apiVersion: argoproj.io/v1alpha1
|
|
kind: Workflow
|
|
metadata:
|
|
generateName: openldap-qualif-
|
|
spec:
|
|
entrypoint: test-deployment
|
|
arguments:
|
|
parameters:
|
|
- name: namespace
|
|
value: openldap-qualif
|
|
- name: app
|
|
value: openldap-qualif
|
|
# This spec contains two templates: hello-hello-hello and whalesay
|
|
templates:
|
|
- name: test-deployment
|
|
parallelism: 1
|
|
# Instead of just running a container
|
|
# This template has a sequence of steps
|
|
steps:
|
|
- - name: wait-upgrade # hello1 is run before the following steps
|
|
template: wait-upgrade
|
|
arguments:
|
|
parameters:
|
|
- name: time
|
|
value: 10
|
|
- name: type
|
|
value: sts
|
|
- - name: test-openldap-upgrade # double dash => run after previous step
|
|
template: test-openldap-upgrade
|
|
arguments:
|
|
parameters:
|
|
- name: url
|
|
value: "{{workflow.parameters.app}}.{{workflow.parameters.namespace}}"
|
|
- name: password
|
|
value: "Not@SecurePassw0rd"
|
|
- name: user
|
|
value: "cn=admin,dc=example,dc=org"
|
|
- name: occurence
|
|
value: "{{item}}"
|
|
withSequence:
|
|
count: "1"
|
|
- - name: apply-chaos-test # double dash => run after previous step
|
|
template: apply-chaos-test
|
|
- - name: test-openldap # double dash => run after previous step
|
|
template: test-openldap-upgrade
|
|
arguments:
|
|
parameters:
|
|
- name: url
|
|
value: "{{workflow.parameters.app}}.{{workflow.parameters.namespace}}"
|
|
- name: password
|
|
value: "Not@SecurePassw0rd"
|
|
- name: user
|
|
value: "cn=admin,dc=example,dc=org"
|
|
- name: occurence
|
|
value: "{{item}}"
|
|
withSequence:
|
|
count: "60"
|
|
- - name: cleanup # double dash => run after previous step
|
|
template: pause-chaos-test
|
|
|
|
# This is the same template as from the previous example
|
|
- name: wait-upgrade
|
|
serviceAccountName: argo-workflow-invocator
|
|
inputs:
|
|
parameters:
|
|
- name: time
|
|
- name: type # type of resources to wait (deployement or sts)
|
|
script:
|
|
image: bitnami/kubectl:1.18.13
|
|
command: [/bin/bash]
|
|
source: |
|
|
sleep {{inputs.parameters.time}}
|
|
kubectl rollout status -n {{workflow.parameters.namespace}} {{inputs.parameters.type}} {{workflow.parameters.app}}
|
|
- name: test-openldap-upgrade
|
|
serviceAccountName: argo-workflow-invocator
|
|
inputs:
|
|
parameters:
|
|
- name: url
|
|
- name: password
|
|
- name: user
|
|
- name: occurence
|
|
script:
|
|
image: alpine
|
|
command: [sh]
|
|
source: | # Contents of the here-script
|
|
apk add openldap-clients
|
|
echo "run ldap commands (add, search, modify...)"
|
|
LDAPTLS_REQCERT=never ldapsearch -x -D '{{inputs.parameters.user}}' -w {{inputs.parameters.password}} -H ldaps://{{inputs.parameters.url}} -b 'dc=example,dc=org'
|
|
sleep 60
|
|
- name: apply-chaos-test
|
|
serviceAccountName: argo-workflow-invocator
|
|
resource: # indicates that this is a resource template
|
|
action: apply # can be any kubectl action (e.g. create, delete, apply, patch)
|
|
manifest: | #put your kubernetes spec here
|
|
apiVersion: chaos-mesh.org/v1alpha1
|
|
kind: PodChaos
|
|
metadata:
|
|
name: pod-failure-openldap
|
|
namespace: openldap-qualif
|
|
annotations:
|
|
experiment.chaos-mesh.org/pause: "false"
|
|
spec:
|
|
action: pod-failure
|
|
mode: random-max-percent
|
|
value: "100"
|
|
duration: "15s"
|
|
selector:
|
|
labelSelectors:
|
|
"app": "openldap-qualif"
|
|
scheduler:
|
|
cron: "@every 2m"
|
|
- name: pause-chaos-test
|
|
serviceAccountName: argo-workflow-invocator
|
|
resource: # indicates that this is a resource template
|
|
action: apply # can be any kubectl action (e.g. create, delete, apply, patch)
|
|
manifest: | #put your kubernetes spec here
|
|
apiVersion: chaos-mesh.org/v1alpha1
|
|
kind: PodChaos
|
|
metadata:
|
|
name: pod-failure-openldap
|
|
namespace: openldap-qualif
|
|
annotations:
|
|
experiment.chaos-mesh.org/pause: "true"
|
|
spec:
|
|
action: pod-failure
|
|
mode: random-max-percent
|
|
value: "100"
|
|
duration: "15s"
|
|
selector:
|
|
labelSelectors:
|
|
"app": "openldap-qualif"
|
|
scheduler:
|
|
cron: "@every 2m" |