helm-charts icon indicating copy to clipboard operation
helm-charts copied to clipboard

Automatically clean up backup jobs and pods

Open mcandre opened this issue 3 years ago • 3 comments

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.

mcandre avatar May 07 '21 15:05 mcandre

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 avatar Jun 03 '21 14:06 mcandre

@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.

torstenwalter avatar Aug 04 '21 10:08 torstenwalter

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.

stale[bot] avatar Apr 16 '22 11:04 stale[bot]

@timja can be closed

kvanzuijlen avatar Feb 02 '24 11:02 kvanzuijlen