---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: litmus-k8s-snap-rebuild-clone-
  namespace: litmus
spec:
  template:
    metadata:
      name: litmus
      labels:
        app: k8s-snap-rebuild-clone

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

        env:
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

          - name: APP_LABEL
            value: app=busybox-sts

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

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

          - name: PROVIDER_STORAGE_CLASS
            value: openebs-snapshot-promoter

          - name: SNAPSHOT_NAME
            value: busybox-snap

          - name: CLONE_VOL_CLAIM
            value: post-rebuild-clone-claim

          - name: CLONE_APP_NAME
            value: busybox-clone
          
          - name: CONTAINER_NAME
            value: cstor-pool
            
            # clone action 
          - name: CLONE_ACTION
            # Supported values: post-rebuild,pre-rebuild,during-rebuild
            value: "post-rebuild"

          - name: CAPACITY
            value: 5Gi            

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