-
Notifications
You must be signed in to change notification settings - Fork 1
CronJob
Gregory Nickonov edited this page Mar 4, 2019
·
3 revisions
R.cron_job 'logs-cleaner' do
# Run midnight UTC every single day
schedule '0 0 * * *'
# Default restart policy is :OnFailure, see below
pod_template_spec.restart_policy :Never
container do
# Setup main container
end
end
CronJob is one of the Pod Template Owners, so all methods, like pod_template
and container
are available.
By default, Pod's restart_policy
is Always
, but this value is invalid for CronJobs and leads to the error when creating the CronJob. To simplify development, in Sunstone default value for restart policy is OnFailure
, so if you don't want the CronJob to be restarted in case of failure don't' forget to set the value to Never
.
Sunstone property | Kubernetes property | Type |
---|---|---|
metadata | metadata | Kubernetes Object Metadata |
spec | spec | CronJobSpec |
A shortcut to spec.schedule
, used to specify a run schedule in the Cron format.
Sunstone property | Kubernetes property | Type |
---|---|---|
concurrency_policy | concurrencyPolicy | String |
failed_jobs_history_limit | failedJobsHistoryLimit | Integer |
job_template | jobTemplate | JobTemplateSpec |
schedule | schedule | String |
successful_jobs_history_limit | successfulJobsHistoryLimit | Integer |
suspend | suspend | Boolean |
Sunstone property | Kubernetes property | Type |
---|---|---|
metadata | metadata | Kubernetes Object Metadata |
spec | spec | JobSpec |