# https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: import-job
spec:
  schedule: "*/2 * * * *"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 1
  failedJobsHistoryLimit: 2
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: import-job
            image: com.io/k8.demo.cronjobs:v1
            command: ["./K8.LongProcess"]
            env:
              - name: MSI_ENDPOINT
                value: http://host.docker.internal:5050/oauth2/token
              - name: MSI_SECRET
                value: 19603b25-f198-4156-a82a-b68d40681455
            args:
            - "-t Import"
            - "-d 20"
            - "-c 10"
          restartPolicy: OnFailure
