diff --git a/cron-workflows/.DS_Store b/cron-workflows/.DS_Store deleted file mode 100644 index 4e206e1..0000000 Binary files a/cron-workflows/.DS_Store and /dev/null differ diff --git a/workflows/.DS_Store b/workflows/.DS_Store deleted file mode 100644 index 975c493..0000000 Binary files a/workflows/.DS_Store and /dev/null differ diff --git a/workflows/namespaced-scope-chaos/workflow.yaml b/workflows/namespaced-scope-chaos/workflow.yaml index bc8c81b..a586ea0 100644 --- a/workflows/namespaced-scope-chaos/workflow.yaml +++ b/workflows/namespaced-scope-chaos/workflow.yaml @@ -8,10 +8,7 @@ spec: arguments: parameters: - name: adminModeNamespace - valueFrom: - configMapKeyRef: - name: litmus-portal-admin-config #This config map is created as a part of namespaced scope installation of litmus-portal, https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/namespaced-K8s-template.yml - key: AgentNamespace + value: litmus templates: - name: argowf-chaos steps: diff --git a/workflows/namespaced-scope-chaos/workflow_cron.yaml b/workflows/namespaced-scope-chaos/workflow_cron.yaml new file mode 100644 index 0000000..265c49a --- /dev/null +++ b/workflows/namespaced-scope-chaos/workflow_cron.yaml @@ -0,0 +1,174 @@ +apiVersion: argoproj.io/v1alpha1 +kind: CronWorkflow +metadata: + name: argo-chaos-hello-world-pod-delete-cron-wf +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 + resources: + limits: + memory: 128Mi + cpu: 50m + 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: pod-delete-chaos + namespace: {{workflow.parameters.adminModeNamespace}} + spec: + appinfo: + appns: {{workflow.parameters.adminModeNamespace}} + applabel: 'app=hello-world' + appkind: deployment + jobCleanUpPolicy: retain + monitoring: false + annotationCheck: 'false' + engineState: 'active' + chaosServiceAccount: litmus-namespace-admin + experiments: + - name: pod-delete + spec: + components: + resources: + requests: + memory: 128Mi + cpu: 50m + limits: + memory: 128Mi + cpu: 50m + env: + - name: TOTAL_CHAOS_DURATION + value: "30" + - name: CHAOS_INTERVAL + value: "10" + - name: FORCE + value: "false" + container: + image: litmuschaos/litmus-checker:latest + resources: + limits: + memory: 128Mi + cpu: 50m + args: + - -file=/tmp/chaosengine.yaml + - -saveName=/tmp/engine-name + + - name: revert-chaos + container: + image: lachlanevenson/k8s-kubectl + resources: + limits: + memory: 128Mi + cpu: 50m + command: [sh, -c] + args: + - "kubectl delete chaosengine pod-delete-chaos -n {{workflow.parameters.adminModeNamespace}}"