apiVersion: batch/v1
kind: Job
metadata:
  name: $JOBGROUP-$JOBNAME
  labels:
    jobgroup: $JOBGROUP
spec:
  backoffLimit: 2
  template:
    metadata:
      name: $JOBGROUP-$JOBNAME
      labels:
        jobgroup: $JOBGROUP
    spec:
      containers:
      - image: nexusjpl/ningester:$NINGESTERTAG
        name: ningester-$JOBGROUP-$JOBNAME
        args: ["$PROFILES"]
        resources:
          requests:
            cpu: "0.25"
            memory: "2Gi"
        env:
        - name: MYSQL_ROOT_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysql-pass
              key: password
              optional: true
        volumeMounts:
        - name: data-volume
          mountPath: /home/ningester/data/$GRANULE
        - name: config-volume-1
          mountPath: /home/ningester/config/$JOBCONFIGMAPNAME.yml
        - name: config-volume-2
          mountPath: /home/ningester/config/$CONNECTIONCONFIGMAPNAME.yml
      volumes:
      - name: data-volume
        hostPath:
          path: $GRANULEHOSTPATH/$GRANULE
      - name: config-volume-1
        configMap:
          name: $JOBCONFIGMAPNAME
      - name: config-volume-2
        configMap:
          name: $CONNECTIONCONFIGMAPNAME
      restartPolicy: Never
