diff --git a/helm/charts/duo_facility_proposals/templates/cronjob.yaml b/helm/charts/duo_facility_proposals/templates/cronjob.yaml index ebb0f714..f97caf5a 100644 --- a/helm/charts/duo_facility_proposals/templates/cronjob.yaml +++ b/helm/charts/duo_facility_proposals/templates/cronjob.yaml @@ -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 @@ -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 }} diff --git a/helm/configs/proposals/production/values.yaml b/helm/configs/proposals/production/values.yaml index 70648f4f..af2fed13 100644 --- a/helm/configs/proposals/production/values.yaml +++ b/helm/configs/proposals/production/values.yaml @@ -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 diff --git a/helm/configs/proposals/qa/values.yaml b/helm/configs/proposals/qa/values.yaml index a76c4ccd..50df187d 100644 --- a/helm/configs/proposals/qa/values.yaml +++ b/helm/configs/proposals/qa/values.yaml @@ -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 diff --git a/helm/configs/proposals/values.yaml b/helm/configs/proposals/values.yaml index b80712a7..d35e069c 100644 --- a/helm/configs/proposals/values.yaml +++ b/helm/configs/proposals/values.yaml @@ -23,3 +23,6 @@ volumeMounts: - name: secrets-volume mountPath: /usr/src/proposals/.env subPath: .env + +cronjob: + ttlSecondsAfterFinished: 691200 # 8 days (7+1 of buffer)