---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: lvm-localpv-provisioner-
  namespace: e2e
spec:
  template:
    metadata:
      name: lvm-localpv-provisioner
      labels:
        app: lvm-localpv
    spec:
      serviceAccountName: e2e
      restartPolicy: Never
      containers:
      - name: ansibletest
        image: openebs/lvm-localpv-e2e:ci
        imagePullPolicy: IfNotPresent
        env:
          - name: ANSIBLE_STDOUT_CALLBACK
            value: default

            # This test will download the lvm-localpv operator file from this branch.
            # Change the env value according to versioned branch name for lvm-localpv provisioner
            # from openebs/lvm-localpv repo. for e.g. (v0.1.x , v0.2.x  OR  master)
            # by default test-specific value of `LVM_BRANCH` is master. 
          - name: LVM_BRANCH  
            value: 'master'
           
            # In each branch of openebs/lvm-localpv repo lvm-localpv driver is set to `ci` tag
            # `openebs/lvm-driver:ci`. Give the full image name here with desired image tag to replace
            # it with `ci` tag. for e.g. (openebs/lvm-driver:0.1.0). Leaving this env empty will 
            # apply the operator yaml with by default present `ci` tag i.e. `openebs/lvm-driver:ci`
          - name: LVM_DRIVER_IMAGE
            value: ''
            
            # This is the namespace where the LVM driver will create all its resources.
            # By default it is in openebs namespace. If we want to change it to use a different
            # namespace change the value of this env with desired namespace name.
          - name: OPERATOR_NAMESPACE
            value: 'openebs'
            
            # In addition to provisioning of lvm-localpv driver if we want to create volume groups
            # on the nodes, use `true` as the value for this env else leave it blank.
            # by default this test will skip volume group creation of nodes.
          - name: VOLUME_GROUP_CREATION
            value: ''

            # In case if we have use value as `true` in `VOLUME_GROUP_CREATION` env, provide here
            # the name for volume group by which name it will be created via this test else leave blank.
            # If we don't want to create volume group on nodes via this test but still 
            # wants to create some generally used storage_classes for provisioning of lvm volumes
            # provide here the volume group name which you have already setted up and it will be 
            # used in storage class template.
            # by default test-specific value of volume group name is `lvmvg`.
          - name: VOLUME_GROUP_NAME
            value: 'lvmvg'

            # In case if we have use value as `true` in `VOLUME_GROUP_CREATION` env, provide here
            # the name of the disks to use as the physical volume disks to create volume group on
            # top of them, else leave blank. for e.g. `/dev/sdb`
            # If we want to use more than one disk give the names in space seperated format
            # for e.g. "/dev/sdb /dev/sdc"
          - name: PHYSICAL_VOLUME_DISKS
            value: ''

            # In case if we have use value as `true` in `VOLUME_GROUP_CREATION` env, provide here
            # the name of nodes on which we want volume group to be created. Leaving this blank
            # will create volume group on all the schedulabel nodes.
            # Provide node names in comma seperated format for e.g. ('node-1,node-2,node-3')
          - name: NODE_NAMES
            value: ''

            # If we want to create some generally used storage_classes for provisioning of lvm volumes
            # provide `true` as the value for this env. by default test-specific value for this env is 
            # blank that means it will not create any storage-class in execution of this test.
          - name: STORAGE_CLASS_CREATION
            value: ''

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./e2e-tests/experiments/lvm-localpv-provisioner/test.yml -i /etc/ansible/hosts -v; exit 0"]