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

          - name: APP_LABEL
            value: 'app=pgset'  

          - name: LOADGEN_LABEL
            value: 'loadgen=crunchy-loadgen'
             
            #namespace in which loadgen will run 
          - name: APP_NAMESPACE
            value: app-pgres-ns
    
            # Database Name 
          - name: DATABASE_NAME
            value: postgres
    
           # Password to access Database
          - name: PASSWORD
            value: password
    
           # Database user
          - name: DATABASE_USER
            value: postgres
          
            #Port on which crunchy databse is listening
          - name: PORT
            value: "5432"
            
            #Number of parallel transactions to perform
          - name: PARALLEL_TRANSACTION
            value: "5"
            
            #Number of transaction to perform
          - name: TRANSACTIONS
            value: "200"  

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