apiVersion: batch/v1
kind: Job
metadata:
  name: test-mongo-read
  labels:
    app: test-mongo-read
spec:
  completions: 3
  parallelism: 3
  template:
    metadata:
      labels:
        app: test-mongo-read
    spec:
      restartPolicy: Never
      containers:
      - name: test-mongo-read
        image: mongo:4.2.2
        command:
        - "/bin/bash"
        - "/test-read.sh"
        env:
        - name: DOCUMENTS
          value: "10"
        - name: MONGO_INITDB_ROOT_USERNAME
          valueFrom:
            secretKeyRef:
              name: mongodb-credentials
              key: username
        - name: MONGO_INITDB_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mongodb-credentials
              key: password
        volumeMounts:
        - name: test-read
          mountPath: /test-read.sh
          subPath: test-read.sh
      volumes:
      - name: test-read
        configMap:
          name: test-read
