---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: disk-failure-
  namespace: litmus
spec:
  template:
    metadata:
      labels:
        name: disk-failure
    spec:
      serviceAccountName: litmus
      restartPolicy: Never
      #nodeSelector:
      #  kubernetes.io/hostname:
 
      tolerations:
      - key: "infra-aid"
        operator: "Equal"
        value: "observer"
        effect: "NoSchedule"

      containers:
      - name: ansibletest
        image: openebs/ansible-runner:ci
        imagePullPolicy: Always
        env:
          - name: ANSIBLE_STDOUT_CALLBACK
            #value: log_plays
            #value: actionable
            value: default

          - name: APP_NAMESPACE
            value: app-percona-ns 

          - name: APP_LABEL
            value: 'name=percona'

          - name: APP_PVC
            value: percona-mysql-claim

          - name: LIVENESS_APP_LABEL
            value: "liveness=percona-liveness"

          - name: LIVENESS_APP_NAMESPACE
            value: "litmus"

          - name: DATA_PERSISTENCY
            value: "enable"

          - name: PLATFORM
            value: "AWS"

          ## Value of AWS_ACCESS_KEY_ID need to be replaced with original value
          - name: AWS_ACCESS_KEY_ID
            value: "access_key"

          ## Value of AWS_SECRET_ACCESS_KEY need to be replaced with original value
          - name: AWS_SECRET_ACCESS_KEY
            value: "secret_key"

          ## Value of EBS VOLUME_ID to perform disk operations
          - name: VOLUME_ID
            value: "volume_id"

          - name: INSTANCE_NAME
            value: "instance_name"

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