---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: firefly-iii-cron
  namespace: default
  labels:
    app.kubernetes.io/instance: firefly-iii-cron
    app.kubernetes.io/name: firefly-iii-cron
spec:
  schedule: "*/15 * * * *"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 5
  jobTemplate:
    spec:
      activeDeadlineSeconds: 120
      backoffLimit: 3
      ttlSecondsAfterFinished: 300
      template:
        metadata:
          labels:
            app: firefly-iii
            tier: cron
        spec:
          containers:
            - name: cron
              image: busybox
              imagePullPolicy: IfNotPresent
              command:
                - wget
              args:
                - "firefly-iii:8080/api/v1/cron/$(STATIC_CRON_TOKEN)"
              env:
                - name: STATIC_CRON_TOKEN
                  valueFrom:
                    secretKeyRef:
                      name: firefly-iii-secrets
                      key: static_cron_token
          restartPolicy: Never
