apiVersion: batch/v1
kind: Job
metadata:
  name: "diploma-mongo-initial-script-job"
spec:
  backoffLimit: 0
  parallelism: 1
  completions: 1
  template:
    spec:
      containers:
      - name: "diploma-mongo-initial-script-job"
        image: mongo
        command: ["/bin/sh", "-c"]
        args: ["mongosh --host diploma-mongo-mongodb-sharded --username $MONGO_USER --password $MONGO_PASSWORD --file /data/scripts/initial-script.js"]
        volumeMounts:
        - name: "initial-script"
          mountPath: "/data/scripts"

          readOnly: true
        envFrom:
          - secretRef:
              name: "diploma-mongo-job-env"

      restartPolicy: Never

      volumes:
        - name: "initial-script"
          secret:
            secretName: "diploma-mongo-initial"

