---
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: Always

        env:
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

          - name: APP_LABEL
            value: 'name=percona'

            # Application pvc
          - name: APP_PVC
            value: percona-mysql-claim

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

          - name: PROVIDER_STORAGE_CLASS
            value: openebs-snapshot-promoter

          - name: DB_USER_NAME
            value: root

          - name: DB_PASSWORD
            value: k8sDem0

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

          - name: CLONE_APP_NAME
            value: percona-clone

          - name: DATA_PERSISTENCY
            value: "mysql" 

            # clone action 
          - name: CLONE_ACTION
            # Supported values: post-rebuild,pre-rebuild,during-rebuild
            value: "post-rebuild"

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./percona/functional/snapshot_rebuild/snap_rebuild_clone/test.yml -i /etc/ansible/hosts -vv; exit 0"]
