apiVersion: batch/v1
kind: Job
metadata:
  # Prefix name of job with user and timestamp
  #name: $USER
  name: example
  namespace: stuartlab
spec:
  backoffLimit: 0
  # Delete the log after a minute
  ttlSecondsAfterFinished: 60
  template:
    spec:
      containers:
      - name: magic
        image: $DOCKERHUB_ACCOUNT/kube_test:latest
        imagePullPolicy: Always
        env:
        - name: USER
          value: $USER
        - name: PRP
          value: "https://s3.nautilus.optiputer.net"
        - name: MYDATA
          value: /data/
        - name: MYOUT # outdir pod, defined by the docker image
          value: /results/
        - name: S3DATA
          value: users/ianastop/data/
        - name: S3OUT
          value: users/ianastop/out/ 
        volumeMounts:
        - mountPath: /data
          name: ianastop-storage
        - mountPath: /root/.aws/
          name: s3-credentials
          readOnly: true
        - mountPath: /out
          name: ianastop-out
        resources:
          requests:
            cpu: "2"
            nvidia.com/gpu: 0
            memory: "5G"
            ephemeral-storage: "80G"
          limits:
            cpu: "19"
            nvidia.com/gpu: 0
            memory: "28G"
            ephemeral-storage: "178G"
        command: ['python', 'app.py']
      restartPolicy: Never
      volumes:
      - name: ianastop-storage
        emptyDir: {}
      - name: ianastop-out
        emptyDir: {}  
      - name: s3-credentials
        secret:
          secretName: yianni-secret
