apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: spot-look-back
spec:
  schedule: "*/10 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: spot-look-back
            image: eddiezane/spot-look-back:latest
            args:
            - "--db"
            - "$(DB)"
            - "--token"
            - "$(TOKEN)"
            - "--clientID"
            - "$(CLIENT_ID)"
            - "--clientSecret"
            - "$(CLIENT_SECRET)"
            env:
            - name: DB
              valueFrom:
                secretKeyRef:
                  name: spot-look-back
                  key: db
            - name: TOKEN
              valueFrom:
                secretKeyRef:
                  name: spot-look-back
                  key: token
            - name: CLIENT_ID
              valueFrom:
                secretKeyRef:
                  name: spot-look-back
                  key: clientID
            - name: CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: spot-look-back
                  key: clientSecret
            imagePullPolicy: Always
          restartPolicy: OnFailure
