---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: pod-network-loss- 
spec:
  template:
    metadata:
      labels:
        experiment: pod-network-loss
    spec:
      # Placeholder that is updated by the executor for automated runs
      # Provide appropriate SA (with desired permissions) if executed manually
      serviceAccountName: CHAOS_SERVICE_ACCOUNT
      restartPolicy: Never
      containers:
      - name: ansibletest
        image: litmuschaos/ansible-runner:ci
        imagePullPolicy: Always
        env: 
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

          - name: APP_NAMESPACE
            value: default 

          - name: APP_LABEL
            value: 'app=hello'

          - name: APP_KIND
            value: deployment

          - name: TARGET_CONTAINER
            value: "flux-test"

          - name: NETWORK_INTERFACE
            value: "eth0"

          - name: NETWORK_PACKET_LOSS_PERCENTAGE
            value: "70" # in ms

          - name: TOTAL_CHAOS_DURATION
            value: "60000" # in ms
            
          - name: LIB
            value: "pumba"

          - name: CHAOSENGINE
            value: ""

          - name: CHAOS_SERVICE_ACCOUNT
            valueFrom:
              fieldRef:
                fieldPath: spec.serviceAccountName

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./experiments/generic/pod_network_loss/pod_network_loss_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0"]
        
