---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: e2e-busybox-liveness-
  namespace: e2e
spec:
  activeDeadlineSeconds: 5400
  template:
    metadata:
      name: e2e-busybox-liveness
      namespace: e2e
      labels:
        liveness: e2e-busybox-liveness

        # label used for mass-liveness check upon infra-chaos
        infra-aid: liveness

    spec:
      serviceAccountName: e2e
      restartPolicy: Never
 
      containers:
      - name: ansibletest
        image: openebs/cstor-csi-e2e:ci
        imagePullPolicy: IfNotPresent
        env: 
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

          - name: MY_POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name

          - name: LIVENESS_TIMEOUT_SECONDS
            value: "10"

          # number of retries when livenss-fails 
          - name: LIVENESS_RETRY_COUNT
            value: "5"

            # Namespace in which busybox is running
          - name: NAMESPACE
            value: app-busybox-ns 

          - name: APPLICATION_LABEL
            value: 'app=busybox'

          - name: ACTION
            value: provision

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./e2e-tests/apps/busybox/liveness/test.yml -i /etc/ansible/hosts -v; exit 0"]
