Skip to content

Commit

Permalink
Add ttl to auto remove old failed (#252)
Browse files Browse the repository at this point in the history
* Add ttl to auto remove old failed

* Add default ttl and qa config

* Add prod ttl
  • Loading branch information
minottic authored Jan 22, 2025
1 parent f910eb3 commit ade5606
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion helm/charts/duo_facility_proposals/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $list := include "duo_facility_proposals.facilities_schedule" . | fromYaml}}
{{- range $_ := $list.duo_facilities }}
{{- range $duo_facility := $list.duo_facilities }}
{{- $facility := dict "fullname" (include "duo_facility_proposals.fullname" $) "name" .name "year" .year }}
apiVersion: batch/v1
kind: CronJob
Expand All @@ -12,6 +12,9 @@ spec:
schedule: {{ .schedule | default $.Values.cronjob.schedule | quote }}
jobTemplate:
spec:
{{- with $.Values.cronjob.ttlSecondsAfterFinished }}
ttlSecondsAfterFinished: {{ $duo_facility.ttlSecondsAfterFinished | default . }}
{{- end }}
template:
metadata:
labels: {{ include "duo_facility_proposals.labels" $ | nindent 12 }}
Expand Down
2 changes: 2 additions & 0 deletions helm/configs/proposals/production/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ duo_facilities:
schedule: 0 2 * * 4
- name: sls
schedule: 0 3 * * 1,3,5
ttlSecondsAfterFinished: 345600 # 4 (3+1 of buffer) days
- name: swissfel
schedule: 0 4 * * 1,3,5
ttlSecondsAfterFinished: 345600 # 4 (3+1 of buffer) days
- name: smus
schedule: 0 5 * * 4
- name: sinq
Expand Down
2 changes: 2 additions & 0 deletions helm/configs/proposals/qa/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ duo_facilities:
schedule: 0 2 * * 2
- name: sls
schedule: 30 3 * * 1,3,5
ttlSecondsAfterFinished: 345600 # 4 (3+1 of buffer) days
- name: swissfel
schedule: 30 4 * * 1,3,5
ttlSecondsAfterFinished: 345600 # 4 (3+1 of buffer) days
- name: smus
schedule: 0 5 * * 2
- name: sinq
Expand Down
3 changes: 3 additions & 0 deletions helm/configs/proposals/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ volumeMounts:
- name: secrets-volume
mountPath: /usr/src/proposals/.env
subPath: .env

cronjob:
ttlSecondsAfterFinished: 691200 # 8 days (7+1 of buffer)

0 comments on commit ade5606

Please sign in to comment.