apiVersion: litmuschaos.io/v1alpha1
description:
  message: |
    Injects network packet loss on pods belonging to an app deployment
kind: ChaosExperiment
metadata:
  name: pod-network-loss
spec:
  definition:
    scope: Namespaced
    permissions:
    - apiGroups:
        - ""
        - "batch"
        - "litmuschaos.io"
      resources:
        - "jobs"
        - "pods"
        - "pods/log"
        - "events"
        - "chaosengines"
        - "chaosexperiments"
        - "chaosresults"
      verbs:
        - "get"
        - "list"
        - "patch"
        - "create"
        - "update"
        - "delete"
    image: "litmuschaos/ansible-runner:latest"
    imagePullPolicy: Always
    args:
    - -c
    - ansible-playbook ./experiments/generic/pod_network_loss/pod_network_loss_ansible_logic.yml -i /etc/ansible/hosts -vv; exit 0
    command:
    - /bin/bash
    env:
    - name: ANSIBLE_STDOUT_CALLBACK
      value: 'default'

    - name: TARGET_CONTAINER
      value: ''

    # provide lib image
    - name: LIB_IMAGE
      value: 'gaiaadm/pumba:0.6.5' 

    - name: TC_IMAGE
      value: 'gaiadocker/iproute2'
      
    - name: NETWORK_INTERFACE
      value: 'eth0'

    - name: NETWORK_PACKET_LOSS_PERCENTAGE
      value: '100' #in PERCENTAGE

    - name: TOTAL_CHAOS_DURATION
      value: '60' # in seconds

    # ime period to wait before injection of chaos in sec
    - name: RAMP_TIME
      value: ''

    - name: LIB
      value: 'pumba'
    labels:
      name: pod-network-loss
      app.kubernetes.io/part-of: litmus
      app.kubernetes.io/component: experiment-job
      app.kubernetes.io/version: latest
