K8s Jobber Operator
Quickly implemented Kubernetes controller to enable scheduling of Jobs at a later time.
To schedule a Job later,
- Set .spec.parallelism to 0, which will prevent immediate scheduling of the Job and associated Pods
- Add annotation jobber.vaizki.fi/schedule-at with a ISO 8601 style timestamp
The Job will be scheduled at or after the specified time.
Note: The controller will change the parallelism to 1 and remove the annotation. This behaviour is subject to change.
Find it at https://hub.docker.com/r/vaizki/k8s-jobber
kind: Job apiVersion: batch/v1 metadata: name: back-to-the-future annotations: jobber.vaizki.fi/schedule-at: '2021-12-03T17:28:00.000Z' spec: parallelism: 0 backoffLimit: 4 template: spec: restartPolicy: Never containers: - name: delorean image: bash command: - echo - "What happens in the future stays in the future"
See k8s-jobber.yaml in this repo. Currently you should specify namespaces to watch with -n on the kopf command line.
This is a naive proof-of-concept implementation and not exhaustively tested. Use at your own risk.
Instead of requiring setting parallelism to zero, support Job suspended states which were introduced in k8s 1.22 as alpha features, see: