---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: litmus-app-target-affinity-
  namespace: litmus
spec:
  template:
    metadata:
      name: litmus
      labels:
        app: litmus-affinity

    spec:
      serviceAccountName: litmus
      restartPolicy: Never
      containers:
      - name: ansibletest
        image: openebs/ansible-runner:ci
        imagePullPolicy: IfNotPresent

        env:
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

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

            # Application pvc
          - name: APP_LABEL
            value: app=busybox-sts

            #Target namespace
          - name: OPERATOR_NS
            value: openebs

            # To check affinity for deployments, 'DEPLOY_TYPE'  should be "deployment"
            # To check affinity for statefulsets, 'DEPLOY_TYPE' should be "statefulset"
          - name: DEPLOY_TYPE
            value: deployment

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./experiments/functional/app-target-affinity/test.yml -i /etc/ansible/hosts -vv; exit 0"]
