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

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

    spec:
      serviceAccountName: litmus
      restartPolicy: Never
 
      containers:
      - name: ansibletest
        image: openebs/ansible-runner:ci
        imagePullPolicy: Always
        env: 
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

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

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

      - name: busybox-liveness  
        image: ranjnshashank855/busybox-liveness-client
        imagePullPolicy: Always

        env:

           
          - 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: POD_NAME
            value: busybox-0 

        command: ["/bin/bash"]
        args: ["-c", "./liveness.sh; exit 0"]
