---
apiVersion: batch/v1
kind: Job
metadata:
  name: elasticsearch-liveness
 
spec:
  template:
    metadata:
      name: elasticsearch-liveness
      namespace: app-namespace
      labels:
        liveness: elasticsearch-liveness
   
    spec:
      restartPolicy: Never
      containers:
      - name: elasticsearch-litmus-liveness
        image: openebs/tests-custom-client:latest
        imagePullPolicy: IfNotPresent

        env: 

            # Namespace in which application is running
          - name: NAMESPACE
            value: app-namespace
                                     
            # Service name of application
          - name: SERVICE
            value: "service_name"
    
            # Port on which application is listening
          - name: PORT
            value: "port"   
            
             # Time period (in sec) b/w retries for DB init check
          - name: INIT_WAIT_DELAY
            value: "30"
    
            # No of retries for DB init check 
          - name: INIT_RETRY_COUNT
            value: "10"
    
            # Time period (in sec) b/w liveness checks
          - name: LIVENESS_PERIOD_SECONDS
            value: "10"
    
            # Time period (in sec) b/w retries for db_connect failure
          - name: LIVENESS_TIMEOUT_SECONDS
            value: "liveness-timeout-seconds"
    
            # No of retries after a db_connect failure before declaring liveness fail
          - name: LIVENESS_RETRY_COUNT
            value: "liveness-retry-count"  
 
        command: ["/bin/bash"]
        args: ["-c", "python ./liveness.py ; exit 0"]
