---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: openebs-pool-failure-
  namespace: litmus
spec:
  template:
    metadata:
      labels:
        name: openebs-pool-failure
    spec:
      serviceAccountName: litmus
      restartPolicy: Never

      #nodeSelector:
      #  kubernetes.io/hostname:

      tolerations:
        - key: "infra-aid"
          value: "observer"
          operator: "Equal"
          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: ""

          - name: LIVENESS_APP_NAMESPACE
            value: ""

          - name: DATA_PERSISTENCY
            value: "enable"  

          - name: CHAOS_TYPE
            value: "pool-kill"

          - name: CHAOS_ITERATIONS
            value: "2" 

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