apiVersion: batch/v1
kind: Job
metadata:
  name: datamon-backup-job
spec:
  template:
    metadata:
      labels:
        app: datamon-backup-job
    spec:
      restartPolicy: Never
      containers:
      - name: datamon-bin
        image: gcr.io/onec-co/datamon-datamover:$DOCKER_IMG_TAG
        imagePullPolicy: "Always"
        command: ["backup"]
        args: [
        "-d", "/filestore/output",
        "-u", "$UNLINKABLE_LIST",
        "-t", "$IS_TEST_DEBUG"
        ]

        stdin: true
        tty: true
        volumeMounts:
        - mountPath: /filestore
          name: shared-vol

        # resources:
        #   requests:
        #     memory: "15G"

        - mountPath: /tmp/gac
          name: google-application-credentials

        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /tmp/gac/google-application-credentials.json

      volumes:

      - name: google-application-credentials
        secret:
          secretName: google-application-credentials

      - name: shared-vol
        persistentVolumeClaim:
          claimName: $PVC_NAME
          # readOnly: false

      # tolerations:
      # - key: "oneconcern.com/flood"
      #   operator: Equal
      #   value: "inundation"
      # nodeSelector:
      #   kubernetes.io/role: "flood-pipeline"

      # tolerations:
      #   - key: "oneconcern.com/dedicated"
      #     operator: Equal
      #     value: "geodude"
      # nodeSelector:
      #     kubernetes.io/role: "geodude"
