Cronjobs
Define your workload to be deployed as a Kubernetes CronJob through a Score extension file.
The extension file needs to request a Workload Profile which creates a CronJob, such as the built-in default-cronjob Workload Profile.
The CronJob schedules are defined in the spec.schedules
section of the extension file. Refer to the schedules feature for configuration details.
You may optionally also set additional properties for the Kubernetes CronJob
, Job
, and Pod
objects which will be created. You can set almost any property of the Kubernetes API specifications for those objects. Refer to the CronJob feature , Job feature , and Pod feature descriptions for details on supported properties.
humanitec.score.yaml
(view on GitHub )
:
apiVersion: humanitec.org/v1b1
# Select the "default-cronjob" built-in Workload Profile
profile: humanitec/default-cronjob
spec:
# Define the CronJob schedules
schedules:
6-hour-run:
containers:
main-container:
args:
- "--hours"
- "6"
schedule: "15 1,7,13,19 * * *"
cronjob:
# Set annotations and labels in the CronJob object metadata
annotations:
cronjobannotationkey: cronjobannotationvalue
labels:
cronjoblabelkey: cronjoblabelvalue
# Set properties of the CronJobSpec, e.g.:
timeZone: Africa/Lagos
concurrencyPolicy: Forbid
job:
# Set annotations and labels in the Job object metadata for the Jobs created out of the CronJob
annotations:
jobannotationkey: jobannotationvalue
labels:
joblabelkey: joblabelvalue
# Set properties of the JobSpec, e.g.:
activeDeadlineSeconds: 30
ttlSecondsAfterFinished: 3600
pod:
# Set Pod annotations and labels in Pod metadata
annotations:
podannotationkey: podannotationvalue
labels:
podlabelkey: podlabelvalue
# Set properties of the PodSpec, e.g.:
nodeSelector:
topology.kubernetes.io/region: europe-west3
os:
name: linux
score.yaml
(view on GitHub )
:
apiVersion: score.dev/v1b1
metadata:
name: my-cronjob
containers:
main-container:
image: .