kind: Workflow
apiVersion: argoproj.io/v1alpha1
metadata:
  name: cart-service-pod-network-latency
  namespace: litmus
  creationTimestamp: null
  labels:
    infra_id: 5b9be872-6396-4ad1-b64a-ed4b25edd516
    revision_id: bd738dca-14f0-4145-8f67-afb3d8c17991
    workflow_id: 1912f522-5197-4bd5-8854-732ccf1882bb
    workflows.argoproj.io/controller-instanceid: 5b9be872-6396-4ad1-b64a-ed4b25edd516
spec:
  templates:
    - name: test
      inputs: {}
      outputs: {}
      metadata: {}
      steps:
        - - name: install-chaos-faults
            template: install-chaos-faults
            arguments: {}
        - - name: pod-network-latency-pok
            template: pod-network-latency-pok
            arguments: {}
        - - name: cleanup-chaos-resources
            template: cleanup-chaos-resources
            arguments: {}
    - name: install-chaos-faults
      inputs:
        artifacts:
          - name: pod-network-latency-pok
            path: /tmp/pod-network-latency-pok.yaml
            raw:
              data: >
                apiVersion: litmuschaos.io/v1alpha1

                description:
                  message: |
                    Injects network latency on pods belonging to an app deployment
                kind: ChaosExperiment

                metadata:
                  name: pod-network-latency
                  labels:
                    name: pod-network-latency
                    app.kubernetes.io/part-of: litmus
                    app.kubernetes.io/component: chaosexperiment
                    app.kubernetes.io/version: ci
                spec:
                  definition:
                    scope: Namespaced
                    permissions:
                      - apiGroups:
                          - ""
                        resources:
                          - pods
                        verbs:
                          - create
                          - delete
                          - get
                          - list
                          - patch
                          - update
                          - deletecollection
                      - apiGroups:
                          - ""
                        resources:
                          - events
                        verbs:
                          - create
                          - get
                          - list
                          - patch
                          - update
                      - apiGroups:
                          - ""
                        resources:
                          - configmaps
                        verbs:
                          - get
                          - list
                      - apiGroups:
                          - ""
                        resources:
                          - pods/log
                        verbs:
                          - get
                          - list
                          - watch
                      - apiGroups:
                          - ""
                        resources:
                          - pods/exec
                        verbs:
                          - get
                          - list
                          - create
                      - apiGroups:
                          - apps
                        resources:
                          - deployments
                          - statefulsets
                          - replicasets
                          - daemonsets
                        verbs:
                          - list
                          - get
                      - apiGroups:
                          - apps.openshift.io
                        resources:
                          - deploymentconfigs
                        verbs:
                          - list
                          - get
                      - apiGroups:
                          - ""
                        resources:
                          - replicationcontrollers
                        verbs:
                          - get
                          - list
                      - apiGroups:
                          - argoproj.io
                        resources:
                          - rollouts
                        verbs:
                          - list
                          - get
                      - apiGroups:
                          - batch
                        resources:
                          - jobs
                        verbs:
                          - create
                          - list
                          - get
                          - delete
                          - deletecollection
                      - apiGroups:
                          - litmuschaos.io
                        resources:
                          - chaosengines
                          - chaosexperiments
                          - chaosresults
                        verbs:
                          - create
                          - list
                          - get
                          - patch
                          - update
                          - delete
                    image: docker.io/litmuschaos/go-runner:latest
                    imagePullPolicy: Always
                    args:
                      - -c
                      - ./experiments -name pod-network-latency
                    command:
                      - /bin/bash
                    env:
                      - name: TARGET_CONTAINER
                        value: ""
                      - name: NETWORK_INTERFACE
                        value: eth0
                      - name: LIB_IMAGE
                        value: docker.io/litmuschaos/go-runner:latest
                      - name: TC_IMAGE
                        value: gaiadocker/iproute2
                      - name: NETWORK_LATENCY
                        value: "2000"
                      - name: TOTAL_CHAOS_DURATION
                        value: "60"
                      - name: RAMP_TIME
                        value: ""
                      - name: JITTER
                        value: "0"
                      - name: PODS_AFFECTED_PERC
                        value: ""
                      - name: TARGET_PODS
                        value: ""
                      - name: CONTAINER_RUNTIME
                        value: containerd
                      - name: DEFAULT_HEALTH_CHECK
                        value: "false"
                      - name: DESTINATION_IPS
                        value: ""
                      - name: DESTINATION_HOSTS
                        value: ""
                      - name: SOCKET_PATH
                        value: /run/containerd/containerd.sock
                      - name: NODE_LABEL
                        value: ""
                      - name: SEQUENCE
                        value: parallel
                    labels:
                      name: pod-network-latency
                      app.kubernetes.io/part-of: litmus
                      app.kubernetes.io/component: experiment-job
                      app.kubernetes.io/runtime-api-usage: "true"
                      app.kubernetes.io/version: ci
      outputs: {}
      metadata: {}
      container:
        name: ""
        image: litmuschaos/k8s:2.11.0
        command:
          - sh
          - -c
        args:
          - kubectl apply -f /tmp/ -n {{workflow.parameters.adminModeNamespace}}
            && sleep 30
        resources: {}
    - name: cleanup-chaos-resources
      inputs: {}
      outputs: {}
      metadata: {}
      container:
        name: ""
        image: litmuschaos/k8s:2.11.0
        command:
          - sh
          - -c
        args:
          - kubectl delete chaosengine -l workflow_run_id={{workflow.uid}} -n
            {{workflow.parameters.adminModeNamespace}}
        resources: {}
    - name: pod-network-latency-pok
      inputs:
        artifacts:
          - name: pod-network-latency-pok
            path: /tmp/chaosengine-pod-network-latency-pok.yaml
            raw:
              data: >
                apiVersion: litmuschaos.io/v1alpha1

                kind: ChaosEngine

                metadata:
                  namespace: "{{workflow.parameters.adminModeNamespace}}"
                  labels:
                    workflow_run_id: "{{ workflow.uid }}"
                    workflow_name: cart-service-pod-network-latency
                  annotations:
                    probeRef: '[{"name":"cart-service-pod-network-latency-probe","mode":"EOT"}]'
                  generateName: pod-network-latency-pok
                spec:
                  engineState: active
                  appinfo:
                    appns: otel-demo
                    applabel: app.kubernetes.io/component=cartservice
                    appkind: deployment
                  chaosServiceAccount: litmus-admin
                  experiments:
                    - name: pod-network-latency
                      spec:
                        components:
                          env:
                            - name: TARGET_CONTAINER
                              value: ""
                            - name: NETWORK_INTERFACE
                              value: eth0
                            - name: LIB_IMAGE
                              value: docker.io/litmuschaos/go-runner:latest
                            - name: TC_IMAGE
                              value: gaiadocker/iproute2
                            - name: NETWORK_LATENCY
                              value: "2000"
                            - name: TOTAL_CHAOS_DURATION
                              value: "150"
                            - name: RAMP_TIME
                              value: ""
                            - name: JITTER
                              value: "0"
                            - name: PODS_AFFECTED_PERC
                              value: ""
                            - name: TARGET_PODS
                              value: ""
                            - name: CONTAINER_RUNTIME
                              value: containerd
                            - name: DEFAULT_HEALTH_CHECK
                              value: "false"
                            - name: DESTINATION_IPS
                              value: ""
                            - name: DESTINATION_HOSTS
                              value: ""
                            - name: SOCKET_PATH
                              value: /run/containerd/containerd.sock
                            - name: NODE_LABEL
                              value: ""
                            - name: SEQUENCE
                              value: parallel
      outputs: {}
      metadata:
        labels:
          weight: "10"
      container:
        name: ""
        image: docker.io/litmuschaos/litmus-checker:2.11.0
        args:
          - -file=/tmp/chaosengine-pod-network-latency-pok.yaml
          - -saveName=/tmp/engine-name
        resources: {}
  entrypoint: test
  arguments:
    parameters:
      - name: adminModeNamespace
        value: litmus
  serviceAccountName: argo-chaos
  podGC:
    strategy: OnWorkflowCompletion
  securityContext:
    runAsUser: 1000
    runAsNonRoot: true
status:
  startedAt: null
  finishedAt: null
