bjw-s / helm-charts

A collection of Helm charts
https://bjw-s.github.io/helm-charts/
Apache License 2.0
580 stars 106 forks source link

feat(common): add suspend option to CronJob controller #256

Closed maurits-funda closed 8 months ago

maurits-funda commented 9 months ago

Description of the change

It is currently not possible to suspend the CronJob, even though Kubernetes supports this natively. This PR adds support for this option.

The suspend option defaults to false when omitted, so always setting spec.suspend could result in a dirty diffs even though functionally nothing changes. Therefore I've opted to only add it when explicitly set.

Added

Adds the ability to suspend the CronJob as described here: https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#schedule-suspension.

Benefits

More feature complete common chart.

Possible drawbacks

When .spec.suspend changes from true to false on an existing CronJob without a starting deadline, the missed jobs are scheduled immediately.

The documentation recommends setting a starting deadline. The common chart already sets this by default: startingDeadlineSeconds: 30.

Checklist