---
apiVersion: batch/v1
kind: Job
metadata:
  generateName: mongodb-loadgen-
  namespace: e2e
spec:
  template:
    metadata:
      name: mongodb-loadgen
      namespace: e2e
      labels:
        loadgen: mongodb-loadjob
    spec:
      serviceAccountName: e2e
      restartPolicy: Never
      containers:
      - name: ansibletest
        image: openebs/ansible-runner:ci
        imagePullPolicy: IfNotPresent
        env: 
          - name: ANSIBLE_STDOUT_CALLBACK
            #value: log_plays
            value: default

          - name: POD_NAME
            value: mongo-0

          - name: SERVICE_NAME 
            value: mongo

          - name: LOADGEN_LABEL
            value: loadgen=mongo-loadgen

          - name: DATABASE_NAME
            value: sbtest

            # Application label
          - name: APP_LABEL
            value: 'app=mongo'

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

        command: ["/bin/bash"]
        args: ["-c", "ansible-playbook ./apps/mongodb/workload/test.yml -i /etc/ansible/hosts -v; exit 0"]
