helm-charts
helm-charts copied to clipboard
Automatically clean up backup jobs and pods
Is your feature request related to a problem? Please describe.
The backup CronJob litters the namespace with numerous jobs and pods each time the backup runs.
Describe the solution you'd like
When the backup CronJob triggers, delete older job entries that were spawned by that CronJob. For example, limit the job count to the last 3 runs.
Also, when a backup job (CronJob or manual created from CronJob) succeeds, then automatically delete the associated pod.
Stack Overflow describes some ordinary Kubernetes fields for configuring pod and job cleanup.
https://stackoverflow.com/questions/41385403/how-to-automatically-remove-completed-kubernetes-jobs-created-by-a-cronjob
The overall Helm chart values.yaml configuration layout is confusing, I do not know for sure where to put successfulJobsHistoryLimit: 0
or ttlSecondsAfterFinished: 300
. The backup section of the chart smashes so many Kuberntes fields together.
@mcandre https://github.com/jenkinsci/helm-charts/blob/main/charts/jenkins/templates/jenkins-backup-cronjob.yaml contains all the placeholders. Looks like the field you want to configure is currently not there.
Feel free to create a PR which adds an option to configure it. Just like the PR to this issue and ping me to review it.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.
@timja can be closed