diff --git a/charts/stable/nextcloud/Chart.yaml b/charts/stable/nextcloud/Chart.yaml index d2379be2949..eba6b27652b 100644 --- a/charts/stable/nextcloud/Chart.yaml +++ b/charts/stable/nextcloud/Chart.yaml @@ -29,7 +29,7 @@ sources: - https://github.com/nextcloud/docker - https://github.com/nextcloud/helm type: application -version: 22.2.4 +version: 22.2.5 annotations: truecharts.org/category: cloud truecharts.org/SCALE-support: "true" diff --git a/charts/stable/nextcloud/ci/basic-values.yaml b/charts/stable/nextcloud/ci/basic-values.yaml index 5ec603bf6ba..e5824f12c69 100644 --- a/charts/stable/nextcloud/ci/basic-values.yaml +++ b/charts/stable/nextcloud/ci/basic-values.yaml @@ -3,3 +3,5 @@ nextcloud: enabled: true collabora: enabled: true + general: + accessIP: 127.0.0.1 diff --git a/charts/stable/nextcloud/templates/_configmap.tpl b/charts/stable/nextcloud/templates/_configmap.tpl index d5a8796add2..66b01c3ae83 100644 --- a/charts/stable/nextcloud/templates/_configmap.tpl +++ b/charts/stable/nextcloud/templates/_configmap.tpl @@ -1,22 +1,35 @@ +{{- define "nextcloud.accessurl" -}} + {{- $accessUrl := .Values.chartContext.APPURL -}} + {{- if or (contains "127.0.0.1" $accessUrl) (contains "localhost" $accessUrl) -}} + {{- if .Values.nextcloud.general.accessIP -}} + {{- $prot := "http" -}} + {{- $host := .Values.nextcloud.general.accessIP -}} + {{- $port := .Values.service.main.ports.main.port -}} + {{/* + Allowing here to override protocol and port + should be enough to make it work with any rev proxy + */}} + {{- $accessUrl = printf "%v://%v:%v" $prot $host $port -}} + {{- end -}} + {{- end -}} + + {{- $accessUrl -}} +{{- end -}} + +{{- define "nextcloud.accesshost" -}} + {{- $accessUrl := (include "nextcloud.accessurl" $) -}} + {{- $accessHost := regexReplaceAll ".*://(.*)" $accessUrl "${1}" -}} + {{- $accessHost = regexReplaceAll "(.*):.*" $accessHost "${1}" -}} + + {{- $accessHost -}} +{{- end -}} + {{/* Define the configmap */}} {{- define "nextcloud.configmaps" -}} {{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}} {{- $fqdn := (include "tc.v1.common.lib.chart.names.fqdn" $) -}} -{{- $accessUrl := .Values.chartContext.APPURL -}} -{{- if or (contains "127.0.0.1" $accessUrl) (contains "localhost" $accessUrl) -}} - {{- if .Values.nextcloud.general.accessIP -}} - {{- $prot := "http" -}} - {{- $host := .Values.nextcloud.general.accessIP -}} - {{- $port := .Values.service.main.ports.main.port -}} - {{/* - Allowing here to override protocol and port - should be enough to make it work with any rev proxy - */}} - {{- $accessUrl = printf "%v://%v:%v" $prot $host $port -}} - {{- end -}} -{{- end -}} -{{- $accessHost := regexReplaceAll ".*://(.*)" $accessUrl "${1}" -}} -{{- $accessHost = regexReplaceAll "(.*):.*" $accessUrl "${1}" -}} +{{- $accessUrl := (include "nextcloud.accessurl" $) -}} +{{- $accessHost := (include "nextcloud.accesshost" $) -}} {{- $accessHostPort := regexReplaceAll ".*://(.*)" $accessUrl "${1}" -}} {{- $accessProtocol := regexReplaceAll "(.*)://.*" $accessUrl "${1}" -}} {{- $redisHost := .Values.redis.creds.plainhost | trimAll "\"" -}} diff --git a/charts/stable/nextcloud/templates/common.yaml b/charts/stable/nextcloud/templates/common.yaml index 22ed3e0e564..1eeaf033ebe 100644 --- a/charts/stable/nextcloud/templates/common.yaml +++ b/charts/stable/nextcloud/templates/common.yaml @@ -9,6 +9,18 @@ {{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}} {{- end -}} +{{/* Create hostAliases (resolve ingress host to Node/LB IP) */}} +{{- $hostAlias := (list (dict + "ip" .Values.nextcloud.general.accessIP + "hostnames" ( + list (include "nextcloud.accesshost" $) + ) + )) -}} + +{{/* Add [hostAliases] to nextcloud and collabora pod */}} +{{- $_ := set .Values.workload.main.podSpec "hostAliases" $hostAlias -}} +{{- $_ := set .Values.workload.collabora.podSpec "hostAliases" $hostAlias -}} + {{/* Add [init perms] container to nextcloud */}} {{- if not (get .Values.workload.main.podSpec "initContainers") -}} {{- $_ := set .Values.workload.main.podSpec "initContainers" dict -}}