---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: litmus-sts-replica-distribution-
  namespace: litmus
spec:
  template:
    metadata:
      name: litmus
      labels:
        app: busybox-statefulset-litmus

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

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

          - name: PROVIDER_STORAGE_CLASS
            value: openebs-cstor-sparse

            # Application pvc
          - name: APP_PVC
            value: openebs-busybox

            # Application label
          - name: APP_LABEL
            value: 'app=busybox-sts'

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

          - name: OPENEBS_NAMESPACE
            value: 'openebs'

          - name: DEPLOY_TYPE
            value: statefulset

          - name: APP_REPLICA
            value: 'replicas=2'

          - name: SCALE_REPLICA_COUNT
            value: '3'
            
          # Use 'deprovision' for app-clean up
          - name: ACTION
            value: provision

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./experiments/functional/sts-volume-distribution/test.yml -i /etc/ansible/hosts -v; exit 0"]
