File tree Expand file tree Collapse file tree 4 files changed +15
-9
lines changed
Expand file tree Collapse file tree 4 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -528,9 +528,9 @@ Check out the [official Nextcloud backup docs](https://docs.nextcloud.com/server
528528
529529Configure ` .nextcloud.backupCronjobs` to install Kubernetes Cronjobs
530530to backup the Nextcloud data volume. The Helm chart automatically
531- adds ` volumes` and ` volumeMounts` to the Cronjobs to make the
532- Nextcloud data folder accessible at the same paths as the Nextcloud
533- containers .
531+ shares the Nextcloud data folder to ( ` volumes` , ` volumeMounts` ) on the
532+ same path. Additionally, it provides the environment variable
533+ ` NEXTCLOUD_DATA_DIR ` .
534534
535535Example:
536536
@@ -556,7 +556,7 @@ Example:
556556 command:
557557 - /bin/sh
558558 - -c
559- - " restic --quiet --json --host nextcloud-data --tag cron backup /var/www/html/data "
559+ - " restic --quiet --json --host nextcloud-data --tag cron backup ${NEXTCLOUD_DATA_DIR} "
560560 env:
561561 - name: RESTIC_CACHE_DIR
562562 value: /run/restic/cache
Original file line number Diff line number Diff line change @@ -292,6 +292,11 @@ Create volume mounts for the nextcloud container as well as the cron sidecar con
292292{{- end }}
293293{{- end -}}
294294
295+ {{- define " nextcloud.backupCronJobEnv" -}}
296+ - name: NEXTCLOUD_DATA_DIR
297+ value: {{ .Values.nextcloud.datadir | quote }}
298+ {{- end -}}
299+
295300{{- define " nextcloud.backupCronJobVolumes" -}}
296301{{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }}
297302- name: nextcloud-data
Original file line number Diff line number Diff line change @@ -16,12 +16,13 @@ spec:
1616 {{- $volumes := dict "spec" (dict "template" (dict "spec" (dict "volumes" $volumeList))) -}}
1717 {{- $jobTemplate := merge $volumes .jobTemplate -}}
1818
19- {{/* Add the volumeMounts to every container */}}
19+ {{/* Add the volumeMounts and environment variables to every container */}}
2020 {{- $containers := list -}}
2121 {{- 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 .) -}}
22+ {{- $vm := dict "volumeMounts" (concat (default list .volumeMounts) (include "nextcloud.backupCronJobVolumeMounts" $ | fromYamlArray)) -}}
23+ {{- $containers = append $containers (merge $vm .) -}}
24+ {{- $env := concat (default list .env) (include "nextcloud.backupCronJobEnv" $ | fromYamlArray) -}}
25+ {{- $containers = append $containers (merge (dict "env" $env) .) -}}
2526 {{- end -}}
2627
2728 {{- $newContainers := dict "spec" (dict "template" (dict "spec" (dict "containers" $containers))) -}}
Original file line number Diff line number Diff line change @@ -216,7 +216,7 @@ nextcloud:
216216 # command:
217217 # - /bin/sh
218218 # - -c
219- # - "restic --quiet --json --host nextcloud-data --tag cron backup /var/www/html/data "
219+ # - "restic --quiet --json --host nextcloud-data --tag cron backup ${NEXTCLOUD_DATA_DIR} "
220220 # env:
221221 # - name: TZ
222222 # value: "Europe/Berlin"
You can’t perform that action at this time.
0 commit comments