2021-07-02 18:32:29 +00:00
|
|
|
{{/* Define the cronjob */}}
|
|
|
|
{{- define "nextcloud.cronjob" -}}
|
2022-07-06 11:25:34 +00:00
|
|
|
{{- if .Values.cronjob.enabled -}}
|
2022-06-07 17:41:19 +00:00
|
|
|
{{- $jobName := include "tc.common.names.fullname" . }}
|
2021-07-02 18:49:23 +00:00
|
|
|
|
2021-07-02 18:32:29 +00:00
|
|
|
---
|
2022-07-06 11:25:34 +00:00
|
|
|
apiVersion: batch/v1
|
2021-07-02 18:32:29 +00:00
|
|
|
kind: CronJob
|
|
|
|
metadata:
|
2021-07-02 18:49:23 +00:00
|
|
|
name: {{ printf "%s-cronjob" $jobName }}
|
2021-07-02 18:32:29 +00:00
|
|
|
labels:
|
2022-06-07 17:41:19 +00:00
|
|
|
{{- include "tc.common.labels" . | nindent 4 }}
|
2021-07-02 18:32:29 +00:00
|
|
|
spec:
|
|
|
|
schedule: "{{ .Values.cronjob.schedule }}"
|
|
|
|
concurrencyPolicy: Forbid
|
|
|
|
{{- with .Values.cronjob.failedJobsHistoryLimit }}
|
|
|
|
failedJobsHistoryLimit: {{ . }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.cronjob.successfulJobsHistoryLimit }}
|
|
|
|
successfulJobsHistoryLimit: {{ . }}
|
|
|
|
{{- end }}
|
|
|
|
jobTemplate:
|
|
|
|
metadata:
|
|
|
|
spec:
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
spec:
|
|
|
|
restartPolicy: Never
|
2022-06-07 17:41:19 +00:00
|
|
|
{{- with (include "tc.common.controller.volumes" . | trim) }}
|
2021-07-03 07:51:21 +00:00
|
|
|
volumes:
|
|
|
|
{{- nindent 12 . }}
|
|
|
|
{{- end }}
|
2021-07-02 18:32:29 +00:00
|
|
|
containers:
|
|
|
|
- name: {{ .Chart.Name }}
|
2022-07-06 11:25:34 +00:00
|
|
|
image: '{{ include "tc.common.images.selector" . }}'
|
2021-07-02 18:32:29 +00:00
|
|
|
imagePullPolicy: {{ default .Values.image.pullPolicy }}
|
2022-07-06 11:25:34 +00:00
|
|
|
command:
|
|
|
|
- "/bin/sh"
|
|
|
|
- "-c"
|
|
|
|
- |
|
|
|
|
/bin/bash <<'EOF'
|
|
|
|
echo "running nextcloud cronjob..."
|
|
|
|
php -f /var/www/html/cron.php
|
|
|
|
echo "cronjob finished"
|
2022-07-06 19:52:15 +00:00
|
|
|
{{- if .Values.cronjob.generatePreviews }}
|
|
|
|
echo "Pre-generating Previews..."
|
|
|
|
php /var/www/html/occ preview:pre-generate
|
|
|
|
echo "Previews generated."
|
|
|
|
{{- end }}
|
2022-07-06 11:25:34 +00:00
|
|
|
EOF
|
2021-07-02 18:32:29 +00:00
|
|
|
# Will mount configuration files as www-data (id: 33) by default for nextcloud
|
2022-06-07 17:41:19 +00:00
|
|
|
{{- with (include "tc.common.controller.volumeMounts" . | trim) }}
|
2021-07-03 07:51:21 +00:00
|
|
|
volumeMounts:
|
|
|
|
{{ nindent 16 . }}
|
|
|
|
{{- end }}
|
2021-07-02 18:32:29 +00:00
|
|
|
securityContext:
|
2021-07-03 10:40:52 +00:00
|
|
|
runAsUser: 33
|
2021-07-03 10:58:26 +00:00
|
|
|
runAsGroup: 33
|
2022-07-06 11:25:34 +00:00
|
|
|
readOnlyRootFilesystem: true
|
|
|
|
runAsNonRoot: true
|
2021-07-02 18:32:29 +00:00
|
|
|
resources:
|
2021-07-02 18:49:23 +00:00
|
|
|
{{ toYaml .Values.resources | indent 16 }}
|
2022-07-06 11:25:34 +00:00
|
|
|
{{- end -}}
|
2021-07-02 18:32:29 +00:00
|
|
|
{{- end -}}
|