From 41d2c2b61b7e77510494978f322c51c6850f42e5 Mon Sep 17 00:00:00 2001 From: rizlas Date: Tue, 7 Apr 2026 16:17:07 +0200 Subject: [PATCH 1/2] feat: add useImageCode flag to skip /var/www and /var/www/html volume mounts Signed-off-by: rizlas --- charts/nextcloud/templates/_helpers.tpl | 2 ++ charts/nextcloud/templates/deployment.yaml | 2 ++ charts/nextcloud/values.yaml | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/charts/nextcloud/templates/_helpers.tpl b/charts/nextcloud/templates/_helpers.tpl index f165974b..a080ef18 100644 --- a/charts/nextcloud/templates/_helpers.tpl +++ b/charts/nextcloud/templates/_helpers.tpl @@ -368,12 +368,14 @@ Swift as primary object store env vars Create volume mounts for the nextcloud container as well as the cron sidecar container. */}} {{- define "nextcloud.volumeMounts" -}} +{{- if not .Values.nextcloud.persistence.useImageCode }} - name: nextcloud-main mountPath: /var/www/ subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} +{{- end }} {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - name: nextcloud-data mountPath: {{ .Values.nextcloud.datadir }} diff --git a/charts/nextcloud/templates/deployment.yaml b/charts/nextcloud/templates/deployment.yaml index aaebfe6c..db6d927f 100644 --- a/charts/nextcloud/templates/deployment.yaml +++ b/charts/nextcloud/templates/deployment.yaml @@ -207,12 +207,14 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: + {{- if not .Values.nextcloud.persistence.useImageCode }} - name: nextcloud-main mountPath: /var/www/ subPath: {{ ternary "root" (printf "%s/root" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} - name: nextcloud-main mountPath: /var/www/html subPath: {{ ternary "html" (printf "%s/html" .Values.nextcloud.persistence.subPath) (empty .Values.nextcloud.persistence.subPath) }} + {{- end }} {{- if and .Values.persistence.nextcloudData.enabled .Values.persistence.enabled }} - name: nextcloud-data mountPath: {{ .Values.nextcloud.datadir }} diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index ea331e8a..d7200df8 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -141,6 +141,10 @@ nextcloud: datadir: /var/www/html/data persistence: subPath: + # Set to true when using an image with code baked in (no VOLUME /var/www/html). + # Skips the /var/www/ and /var/www/html mounts so the image code is not masked + # by the PVC. Only granular mounts (config, custom_apps, themes, tmp) are kept. + useImageCode: false # if set, we'll template this list to the NEXTCLOUD_TRUSTED_DOMAINS env var trustedDomains: [] ## SMTP configuration From aabee63f2102668eaec4d229a6f693c5e7e2ecf2 Mon Sep 17 00:00:00 2001 From: rizlas Date: Thu, 9 Apr 2026 11:57:56 +0200 Subject: [PATCH 2/2] chore: readme values update Signed-off-by: rizlas --- charts/nextcloud/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/charts/nextcloud/README.md b/charts/nextcloud/README.md index f42d2b64..aa1ebdad 100644 --- a/charts/nextcloud/README.md +++ b/charts/nextcloud/README.md @@ -153,6 +153,7 @@ The following table lists the configurable parameters of the nextcloud chart and | `nextcloud.mail.smtp.password` | SMTP password | `''` | | `nextcloud.configs` | Config files created in `/var/www/html/config` | `{}` | | `nextcloud.persistence.subPath` | Set the subPath for nextcloud to use in volume | `nil` | +| `nextcloud.persistence.useImageCode` | Skip `/var/www` and `/var/www/html` mounts when using a custom image with code baked in | `false` | | `nextcloud.phpConfigs` | PHP Config files created in `/usr/local/etc/php/conf.d` | `{}` | | `nextcloud.defaultConfigs.\.htaccess` | Default .htaccess to protect `/var/www/html/config` | `true` | | `nextcloud.defaultConfigs.apache-pretty-urls\.config\.php` | Default Apache configuration for rewrite urls | `true` |