From afae229d3a7eb8c20633e049d3f597fb2eab7bbc Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Tue, 8 Dec 2020 10:48:29 +0100 Subject: [COMMON] Configure paths for Ingress Instead of globally choosing between virtualhosts and path based ingress, it's better to allow to choose it per component. Issue-ID: OOM-2641 Signed-off-by: Sylvain Desbureaux Change-Id: I952826d03722693ebae7c95a083b95bf83752d68 --- kubernetes/common/common/templates/_ingress.tpl | 38 +++++-------------------- 1 file changed, 7 insertions(+), 31 deletions(-) (limited to 'kubernetes/common') diff --git a/kubernetes/common/common/templates/_ingress.tpl b/kubernetes/common/common/templates/_ingress.tpl index e57d4bedaa..18f9bb1ba5 100644 --- a/kubernetes/common/common/templates/_ingress.tpl +++ b/kubernetes/common/common/templates/_ingress.tpl @@ -1,42 +1,18 @@ -{{- define "ingress.config.host" -}} -{{- $dot := default . .dot -}} -{{- $baseaddr := (required "'baseaddr' param, set to the specific part of the fqdn, is required." .baseaddr) -}} -{{- $burl := (required "'baseurl' param, set to the generic part of the fqdn, is required." $dot.Values.global.ingress.virtualhost.baseurl) -}} -{{ printf "%s.%s" $baseaddr $burl }} -{{- end -}} - {{- define "ingress.config.port" -}} {{- $dot := default . .dot -}} -{{- if .Values.ingress -}} -{{- if .Values.global.ingress -}} -{{- if or (not .Values.global.ingress.virtualhost) (not .Values.global.ingress.virtualhost.enabled) -}} - - http: - paths: -{{- range .Values.ingress.service }} -{{ $baseaddr := required "baseaddr" .baseaddr }} - - path: {{ include "ingress.config.host" (dict "dot" $dot "baseaddr" $baseaddr) }} - backend: - serviceName: {{ .name }} - servicePort: {{ .port }} -{{- end -}} -{{- else if .Values.ingress.service -}} +{{- $burl := (required "'baseurl' param, set to the generic part of the fqdn, is required." $dot.Values.global.ingress.virtualhost.baseurl) -}} {{ range .Values.ingress.service }} -{{ $baseaddr := required "baseaddr" .baseaddr }} - - host: {{ include "ingress.config.host" (dict "dot" $dot "baseaddr" $baseaddr) }} +{{- $baseaddr := (required "'baseaddr' param, set to the specific part of the fqdn, is required." .baseaddr) }} + - host: {{ printf "%s.%s" $baseaddr $burl }} http: paths: - backend: serviceName: {{ .name }} servicePort: {{ .port }} -{{- end -}} -{{- else -}} - - path: {{ printf "/%s" .Chart.Name }} - backend: - serviceName: {{ .Chart.Name }} - servicePort: {{ .Values.service.externalPort }} -{{- end -}} -{{- end -}} -{{- end -}} + {{- if .path }} + path: {{ .path }} + {{- end }} +{{- end }} {{- end -}} -- cgit 1.2.3-korg