Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/nextcloud/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
18 changes: 18 additions & 0 deletions charts/nextcloud/templates/configmap-cronjob.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
13 changes: 11 additions & 2 deletions charts/nextcloud/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
22 changes: 19 additions & 3 deletions charts/nextcloud/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure, if we like to have more images from small projects here.

if you need a different compatible you could go to k8s cronjobs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand.

if you need a different compatible you could go to k8s cronjobs.

I tried it before, it did not work because the way nextcloud implements cronjob requires PVC with ReadWriteMany, which is not possible in any kubernetes cluster.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried to ask busybox cron and vivix cron if they can provide a non-root compatible crond and this is not an easy task. So that's why I tried another image, which is less popular than busybox. At least this one is an official image, compared to supercronic, which also work as non-root but they do not provide official image.

# -- 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: {}
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
Loading