apiVersion: batch/v1
kind: CronJob
metadata:
  name: firefly-cronjob
  namespace: default
spec:
  # 0am every day
  schedule: "0 0 * * *"
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 2
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: firefly-cronjob
            image: frolvlad/alpine-bash
            imagePullPolicy: IfNotPresent
            command:
            - /bin/bash
            - -c
            - wget -qO- http://fireflyiii:8080/api/v1/cron/$(cat /etc/crontoken)
            volumeMounts:
            - name: ff-secret
              mountPath: /etc/crontoken
              subPath: STATIC_CRON_TOKEN
            securityContext:
              runAsNonRoot: true
              runAsUser: 1000
          restartPolicy: OnFailure
          volumes:
          - name: ff-secret
            secret:
              secretName: firefly-env-secret