diff --git a/charts/nextcloud/Chart.yaml b/charts/nextcloud/Chart.yaml index 395a9abc..a77f9a9f 100644 --- a/charts/nextcloud/Chart.yaml +++ b/charts/nextcloud/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: nextcloud -version: 9.2.2 +version: 9.2.3 # renovate: image=docker.io/library/nextcloud appVersion: 34.0.1 description: A file sharing server that puts the control and security of your own data back into your hands. diff --git a/charts/nextcloud/templates/configmap-cronjob.yaml b/charts/nextcloud/templates/configmap-cronjob.yaml new file mode 100644 index 00000000..d6f50721 --- /dev/null +++ b/charts/nextcloud/templates/configmap-cronjob.yaml @@ -0,0 +1,18 @@ +{{- if and .Values.cronjob.enabled (eq .Values.cronjob.type "sidecar") }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "nextcloud.fullname" . }}-cronjob + labels: + {{- include "nextcloud.labels" ( dict "rootContext" $ ) | nindent 4 }} +data: + {{ with .Values.cronjob.sidecar }} + cronstable.yaml: | + jobs: + - name: cronjob + command: {{ .command | join " " | quote }} + schedule: {{ .schedule | quote }} + captureStdout: true + {{- end }} +{{- end }} diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index 7035c210..5a56025b 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -243,8 +243,8 @@ spec: {{- if and .Values.cronjob.enabled (eq .Values.cronjob.type "sidecar") }} {{- with .Values.cronjob.sidecar }} - name: {{ $.Chart.Name }}-cron - image: {{ include "nextcloud.image" $ }} - imagePullPolicy: {{ $.Values.image.pullPolicy }} + image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag }}" + imagePullPolicy: {{ .pullPolicy }} command: {{- toYaml .command | nindent 12 }} {{- with .lifecycle }} @@ -272,6 +272,10 @@ spec: {{- end }} volumeMounts: {{- include "nextcloud.volumeMounts" $ | trim | nindent 12 }} + - name: nextcloud-cronjob + mountPath: /etc/cronstable.d/cronstable.yaml + subPath: cronstable.yaml + readOnly: true {{- end }} {{- end }}{{/* end-if cronjob.enabled */}} {{- with .Values.nextcloud.extraSidecarContainers }} @@ -379,6 +383,11 @@ spec: name: {{ template "nextcloud.fullname" . }}-hooks defaultMode: 0o755 {{- end }} + {{- if and .Values.cronjob.enabled (eq .Values.cronjob.type "sidecar") }} + - name: nextcloud-cronjob + configMap: + name: {{ template "nextcloud.fullname" . }}-cronjob + {{- end }} {{- with .Values.nextcloud.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index fafdcb7b..ee43b00f 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -680,6 +680,16 @@ cronjob: ## resources: {} + image: + # -- cronstable image registry # can be docker.io and ghcr.io. docker.io has a rate-limit. + registry: ghcr.io + # -- cronstable image name + repository: ptweezy/cronstable + # -- cronstable image tag + tag: 1.2.24-alpine + # -- cronstable image pull policy + pullPolicy: IfNotPresent + # Allow configuration of lifecycle hooks # ref: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/ lifecycle: {} @@ -693,9 +703,15 @@ cronjob: # runAsNonRoot: true # readOnlyRootFilesystem: true - # The command the cronjob container executes. + schedule: "*/5 * * * *" + # The command to run in the cronjob container + # Example to increase memory limit: php -d memory_limit=2G ... command: - - /cron.sh + - php + - -f + - /var/www/html/cron.php + - -- + - --verbose # Uses a Kubernetes CronJob to execute the Nextcloud cron tasks # Note: can run as non-root user. Should run as same user as the Nextcloud pod. @@ -751,7 +767,7 @@ cronjob: # readOnlyRootFilesystem: true # The command to run in the cronjob container - # Example to incerase memory limit: php -d memory_limit=2G ... + # Example to increase memory limit: php -d memory_limit=2G ... command: - php - -f