Skip to content

Commit

Permalink
Enhance documentation of .spec.startingDeadlineSeconds (#9296)
Browse files Browse the repository at this point in the history
* Update cron-jobs.md

* Update automated-tasks-with-cron-jobs.md

* Update cron-jobs.md

* Reword added documentation and add info about error message.

* Fix grammatical typo.

* adjust grammar and punctuation

* adjust grammar and punctuation

* adjust tense
  • Loading branch information
heshamMassoud authored and k8s-ci-robot committed Jul 19, 2018
1 parent 8b00a58 commit 5f70682
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 10 additions & 4 deletions content/en/docs/concepts/workloads/controllers/cron-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,16 @@ If `startingDeadlineSeconds` is set to a large value or left unset (the default)
and if `concurrencyPolicy` is set to `Allow`, the jobs will always run
at least once.

Jobs may fail to run if the CronJob controller is not running or broken for a
span of time from before the start time of the CronJob to start time plus
`startingDeadlineSeconds`, or if the span covers multiple start times and
`concurrencyPolicy` does not allow concurrency.
For every CronJob, the CronJob controller checks how many schedules it missed in the duration from its last scheduled time until now. If there are more than 100 missed schedules, then it does not start the job and logs the error

````
Cannot determine if job needs to be started. Too many missed start time (> 100). Set or decrease .spec.startingDeadlineSeconds or check clock skew.
````

It is important to note that if the `startingDeadlineSeconds` field is set (not `nil`), the controller counts how many missed jobs occurred from the value of `startingDeadlineSeconds` until now rather than from the last scheduled time until now. For example, if `startingDeadlineSeconds` is `200`, the controller counts how many missed jobs occurred in the last 200 seconds.

A CronJob is counted as missed if it has failed to be created at its scheduled time. For example, If `concurrencyPolicy` is set to `Forbid` and a CronJob was attempted to be scheduled when there was a previous schedule still running, then it would count as missed.

For example, suppose a cron job is set to start at exactly `08:30:00` and its
`startingDeadlineSeconds` is set to 10, if the CronJob controller happens to
be down from `08:29:00` to `08:42:00`, the job will not start.
Expand Down
2 changes: 2 additions & 0 deletions content/en/docs/tasks/job/automated-tasks-with-cron-jobs.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ After the deadline, the cron job does not start the job.
Jobs that do not meet their deadline in this way count as failed jobs.
If this field is not specified, the jobs have no deadline.

It is important to note that if the `.spec.startingDeadlineSeconds` field is set (not nil), the CronJob controller counts how many missed jobs occurred from the value of `.spec.startingDeadlineSeconds` until now. For example, if it is set to `200`, it counts how many missed schedules occurred in the last 200 seconds. If there were more than 100 missed schedules, the cronjob would not be scheduled.

### Concurrency Policy

The `.spec.concurrencyPolicy` field is also optional.
Expand Down

0 comments on commit 5f70682

Please sign in to comment.