File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11apiVersion : v2
22name : nextcloud
3- version : 4.6.3
3+ version : 4.7.0-1
44appVersion : 28.0.2
55description : A file sharing server that puts the control and security of your own data back into your hands.
66keywords :
Original file line number Diff line number Diff line change @@ -291,3 +291,23 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con
291291 subPath: {{ $key }}
292292{{- end }}
293293{{- end -}}
294+
295+ {{- define " nextcloud.backupCronJobVolumes" -}}
296+ {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
297+ - name: nextcloud-data
298+ persistentVolumeClaim:
299+ claimName: {{ if .Values.persistence.nextcloudData.existingClaim }}{{ .Values.persistence.nextcloudData.existingClaim }}{{- else }}{{ template " nextcloud.fullname" . }}-nextcloud-data{{- end }}
300+ {{- end }}
301+ {{- end -}}
302+
303+ {{- define " nextcloud.backupCronJobVolumeMounts" -}}
304+ {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
305+ - name: nextcloud-data
306+ mountPath: {{ .Values.nextcloud.datadir }}
307+ subPath: {{ ternary " data" (printf " %s /data" .Values.persistence.nextcloudData.subPath ) (empty .Values.persistence.nextcloudData.subPath ) }}
308+ {{- else }}
309+ - name: nextcloud-main
310+ mountPath: {{ .Values.nextcloud.datadir }}
311+ subPath: {{ ternary " data" (printf " %s /data" .Values.persistence.subPath ) (empty .Values.persistence.subPath ) }}
312+ {{- end }}
313+ {{- end -}}
Original file line number Diff line number Diff line change 1+ {{- range .Values.nextcloud.backupCronjobs }}
2+ ---
3+ apiVersion : batch/v1
4+ kind : CronJob
5+ metadata :
6+ name : {{ template "nextcloud.fullname" $ }}-backup-{{ .name }}
7+ spec :
8+ schedule : {{ .schedule }}
9+ startingDeadlineSeconds : {{ .startingDeadlineSeconds }}
10+ concurrencyPolicy : {{ .concurrencyPolicy }}
11+ successfulJobsHistoryLimit : {{ .successfulJobsHistoryLimit }}
12+ suspend : {{ .suspend }}
13+ jobTemplate :
14+ {{/* Add the volumes */}}
15+ {{- $volumeList := concat (default list .jobTemplate.spec.template.spec.volumes) (include "nextcloud.backupCronJobVolumes" $ | fromYamlArray) -}}
16+ {{- $volumes := dict "spec" (dict "template" (dict "spec" (dict "volumes" $volumeList))) -}}
17+ {{- $jobTemplate := merge $volumes .jobTemplate -}}
18+
19+ {{/* Add the volumeMounts to every container */}}
20+ {{- $containers := list -}}
21+ {{- range .jobTemplate.spec.template.spec.containers -}}
22+ {{- $vm := concat (default list .volumeMounts) (include "nextcloud.backupCronJobVolumeMounts" $ | fromYamlArray) -}}
23+ {{- $this := dict "volumeMounts" $vm -}}
24+ {{- $containers = append $containers (merge $this .) -}}
25+ {{- end -}}
26+
27+ {{- $newContainers := dict "spec" (dict "template" (dict "spec" (dict "containers" $containers))) -}}
28+ {{- $jobTemplate = merge $newContainers $jobTemplate -}}
29+
30+ {{- $jobTemplate | toYaml | nindent 4 -}}
31+ {{- end }}
Original file line number Diff line number Diff line change @@ -193,15 +193,48 @@ nextcloud:
193193 # - name: nextcloud-data
194194 # mountPath: /run/nextcloud/data
195195
196+ # Nextcloud data backup Cronjobs
197+ # See https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/
198+ backupCronjobs : []
199+ # - name: backup
200+ # schedule: "15 * * * *"
201+ # concurrencyPolicy: Forbid
202+ # startingDeadlineSeconds: 300
203+ # successfulJobsHistoryLimit: 3
204+ # suspend: true
205+ # jobTemplate:
206+ # spec:
207+ # backoffLimit: 1
208+ # ttlSecondsAfterFinished: 300
209+ # template:
210+ # spec:
211+ # restartPolicy: OnFailure
212+ # initContainers: []
213+ # containers:
214+ # - name: restic
215+ # image: restic/restic:0.16.4
216+ # imagePullPolicy: IfNotPresent
217+ # command:
218+ # - /bin/sh
219+ # - -c
220+ # - restic backup
221+ # # volumeMounts:
222+ # # - name: privatedir
223+ # # mountPath: /srv/private
224+ # # readOnly: false
225+ # # volumes:
226+ # # - name: privatedir
227+ # # emptyDir: {}
228+
196229 # Extra mounts for the pods. Example shown is for connecting a legacy NFS volume
197230 # to NextCloud pods in Kubernetes. This can then be configured in External Storage
198- extraVolumes :
231+ extraVolumes : []
199232 # - name: nfs
200233 # nfs:
201234 # server: "10.0.0.1"
202235 # path: "/nextcloud_data"
203236 # readOnly: false
204- extraVolumeMounts :
237+ extraVolumeMounts : []
205238 # - name: nfs
206239 # mountPath: "/legacy_data"
207240
You can’t perform that action at this time.
0 commit comments