---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: litmus-jenkins-upgrade-
  namespace: litmus 
spec:
  template:
    metadata:
      name: litmus
      labels:
        app: upgrade-jenkins
   
    spec:
      serviceAccountName: litmus
      restartPolicy: Never
      containers:
      - name: ansibletest
        image: openebs/ansible-runner:ci
        imagePullPolicy: Always

        env: 
          - name: ANSIBLE_STDOUT_CALLBACK
            #value: log_plays, actionable, default
            value: default

            # Application label
          - name: APP_LABEL
            value: 'app=jenkins-app'

            # Application namespace
          - name: APP_NAMESPACE
            value: app-jenkins-ns

            # Either deployment or statefulset
          - name: DEPLOY_TYPE
            value: deployment

            #  App is deployed with other than  Specified image name for application
          - name: IMAGE_NAME
            value: jenkins/jenkins:2.125 
 
        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./jenkins/upgrade/test.yml -i /etc/ansible/hosts -v; exit 0"]
        
