Skip to content

Commit

Permalink
Add ttlSecondsAfterFinished for cronjob - osmcha
Browse files Browse the repository at this point in the history
  • Loading branch information
Rub21 committed Nov 26, 2024
1 parent 37a0f93 commit 6779f4a
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions osm-seed/templates/osmcha-app/cronJob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ metadata:
spec:
schedule: "*/2 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 2
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
ttlSecondsAfterFinished: 120
template:
spec:
containers:
Expand All @@ -32,12 +33,12 @@ spec:
restartPolicy: Never
{{- if .Values.osmchaApi.nodeSelector.enabled }}
nodeSelector:
{{ .Values.osmchaApi.nodeSelector.label_key }} : {{ .Values.osmchaApi.nodeSelector.label_value }}
{{ .Values.osmchaApi.nodeSelector.label_key }}: {{ .Values.osmchaApi.nodeSelector.label_value }}
{{- end }}

---
apiVersion: batch/v1
kind: CronJob
kind: CronJob
metadata:
name: {{ .Release.Name }}-osmcha-process-changesets-cronjob
labels:
Expand All @@ -48,10 +49,11 @@ metadata:
spec:
schedule: "0 * * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 2
failedJobsHistoryLimit: 2
successfulJobsHistoryLimit: 1
failedJobsHistoryLimit: 1
jobTemplate:
spec:
ttlSecondsAfterFinished: 120
template:
spec:
containers:
Expand All @@ -62,13 +64,19 @@ spec:
- /bin/sh
- -c
- |
python manage.py backfill_changesets $(date -d "yesterday" +%Y-%m-%d) $(date +%Y-%m-%d)
YESTERDAY=$(date -d "yesterday" +%Y-%m-%d)
TODAY=$(date +%Y-%m-%d)
python manage.py backfill_changesets "$YESTERDAY" "$TODAY"
EXIT_CODE=$?
exit $EXIT_CODE
envFrom:
- configMapRef:
name: {{ .Release.Name }}-osmcha-common-env
restartPolicy: Never
{{- if .Values.osmchaApi.nodeSelector.enabled }}
nodeSelector:
{{ .Values.osmchaApi.nodeSelector.label_key }} : {{ .Values.osmchaApi.nodeSelector.label_value }}
{{ .Values.osmchaApi.nodeSelector.label_key }}: {{ .Values.osmchaApi.nodeSelector.label_value }}
{{- end }}
{{- end }}

0 comments on commit 6779f4a

Please sign in to comment.