AdvancedCronJob

AdvancedCronJob is an enhanced version of CronJob. The original CronJob creates Job periodically according to schedule rule, but AdvancedCronJob provides template supported multpile job resources.

  1. apiVersion: apps.kruise.io/v1alpha1
  2. kind: AdvancedCronJob
  3. spec:
  4. template:
  5. # Option 1: use jobTemplate, which is equivalent to original CronJob
  6. jobTemplate:
  7. # ...
  8. # Option 2: use broadcastJobTemplate, which will create a BroadcastJob object when cron schedule triggers
  9. broadcastJobTemplate:
  10. # ...
  11. # Options 3(future): ...
  • jobTemplate:create Jobs periodically, which is equivalent to original CronJob
  • broadcastJobTemplate:create BroadcastJobs periodically, which support to dispatch Jobs on every node

AdvancedCronjob

Example

  1. apiVersion: apps.kruise.io/v1alpha1
  2. kind: AdvancedCronJob
  3. metadata:
  4. name: acj-test
  5. spec:
  6. schedule: "*/1 * * * *"
  7. template:
  8. broadcastJobTemplate:
  9. spec:
  10. template:
  11. spec:
  12. containers:
  13. - name: pi
  14. image: perl
  15. command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
  16. restartPolicy: Never
  17. completionPolicy:
  18. type: Always
  19. ttlSecondsAfterFinished: 30

The YAML below defines an AdvancedCronJob. It will create a BroadcastJob every minute, which will run a job on every node.