fix(clickhouse, opensearch): reap finished cleanup Jobs

The post-delete PVC cleanup Jobs of ClickHouse and OpenSearch keep only
before-hook-creation, so a failed run stays for post-mortem. Helm drops
the hook once the release is gone, and nothing else deletes the Job, so
every deleted instance leaves a Completed <release>-cleanup Job and its
pod in the tenant namespace for good; on the cluster the oldest had sat
there for 85 days.

Set ttlSecondsAfterFinished to a day, as pre-delete-unpin in
kubernetes-nodes does, so a succeeded run is reaped and a failed one
still keeps its logs long enough to read.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
This commit is contained in:
Yan Bondarenko committed 2026-12-01 19:33:36 +01:00
1 parent ce04ec3fb8
commit 9227c2e211
4 files changed
+24

No files matched your search

@@ -13,6 +13,9 @@ metadata:
# hook-succeeded so they are reclaimed after a successful uninstall.
"helm.sh/hook-delete-policy": before-hook-creation
spec:
# Helm does not own a post-delete hook after the release is gone, so only
# this reaps the finished Job and its pod; a failed run keeps its logs a day.
ttlSecondsAfterFinished: 86400
activeDeadlineSeconds: 270
template:
metadata:
@@ -101,3 +101,12 @@ tests:
- equal:
path: subjects[0].name
value: ch-test-cleanup
- it: "reaps the finished cleanup Job after a day"
documentSelector:
path: kind
value: Job
asserts:
- equal:
path: spec.ttlSecondsAfterFinished
value: 86400
@@ -10,6 +10,9 @@ metadata:
"helm.sh/hook-weight": "10"
"helm.sh/hook-delete-policy": before-hook-creation
spec:
# Helm does not own a post-delete hook after the release is gone, so only
# this reaps the finished Job and its pod; a failed run keeps its logs a day.
ttlSecondsAfterFinished: 86400
backoffLimit: 1
activeDeadlineSeconds: 120
template:
@@ -103,3 +103,12 @@ tests:
- equal:
path: subjects[0].name
value: os-test-cleanup
- it: "reaps the finished cleanup Job after a day"
documentSelector:
path: kind
value: Job
asserts:
- equal:
path: spec.ttlSecondsAfterFinished
value: 86400