diff --git a/helm/templates/cronjob.yaml b/helm/templates/cronjob.yaml new file mode 100644 index 00000000..9928ff71 --- /dev/null +++ b/helm/templates/cronjob.yaml @@ -0,0 +1,42 @@ +{{- range .Values.cronjob.crons }} +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ .name | quote }} +spec: + schedule: {{ .schedule | quote }} + timeZone: {{ .timeZone | quote }} + concurrencyPolicy: Forbid + jobTemplate: + spec: + backoffLimit: 0 # No retries + template: + spec: + restartPolicy: Never + volumes: + - name: settings-local-volume + configMap: + name: django-configmap + containers: + - name: {{ .name | quote }} + image: "{{ .image.repository }}:{{ default $.Chart.AppVersion .image.tag }}" + imagePullPolicy: {{ .image.pullPolicy }} + volumeMounts: + - name: settings-local-volume + mountPath: /app/ietf/settings/local.py + subPath: local.py + readOnly: true + {{- if $.Values.env }} + env: + - name: "POD_IP" + valueFrom: + fieldRef: + fieldPath: status.podIP + {{- range $key, $val := $.Values.env }} + - name: {{ $key | quote }} + value: {{ $val | quote }} + {{- end }} + {{- end }} + command: {{ .command | toJson }} +{{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 0a84c470..0add2a9c 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -24,7 +24,7 @@ wagtail: repository: "ghcr.io/ietf-tools/www" pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. - # tag: "v2.1.3" + # tag: "v2.1.10" imagePullSecrets: [] nameOverride: "" @@ -199,6 +199,29 @@ memcached: affinity: {} +# ------------------------------------------------------------- +# SCHEDULED JOBS +# ------------------------------------------------------------- + +cronjob: + crons: + - name: mgmt-hourly + schedule: "0 * * * *" # "At minute 0." + timeZone: "Etc/UTC" + image: + repository: "ghcr.io/ietf-tools/www" + pullPolicy: IfNotPresent + # tag: "v2.1.10" + command: ["python", "/app/manage.py", "publish_scheduled"] + - name: mgmt-weekly + schedule: "30 0 * * 0" # "At 00:30 on Sunday." + timeZone: "Etc/UTC" + image: + repository: "ghcr.io/ietf-tools/www" + pullPolicy: IfNotPresent + # tag: "v2.1.10" + command: ["python", "/app/manage.py", "update_index"] + # ------------------------------------------------------------- # COMMON # -------------------------------------------------------------