#----------------------------------------------------
# Creates cron job that starts every minute.
# Only one job at a time is allowed.
#----------------------------------------------------
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: cron-job                                    # Name of the job
spec:
  schedule: "*/1 * * * *"                           # Run every minute
  startingDeadlineSeconds: 20                       # Do not run if start is dalayed for more tham 20 sec
  concurrencyPolicy: Forbid                         # No parallel execution of the job
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: busy-box-container                # Container name
            image: busybox:latest                   # Docker image of the container
            command: ["/bin/sh","-c","sleep 15"]    # Sleep for 15 seconds and quit
          restartPolicy: OnFailure                  # Restart on failure 

