From 42d58cad6e421a85bc135299d41883890fef8ee4 Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Fri, 22 Oct 2021 09:45:48 -0300 Subject: [PATCH] Implemented new addprefix parameter for ingress --- charts/portalmodelo/v0.5.0/questions.yaml | 7 +++++ .../v0.5.0/templates/ingress.yaml | 27 +++++++++++++++++++ charts/portalmodelo/v0.5.0/values.yaml | 1 + 3 files changed, 35 insertions(+) diff --git a/charts/portalmodelo/v0.5.0/questions.yaml b/charts/portalmodelo/v0.5.0/questions.yaml index a863825..9a68d44 100644 --- a/charts/portalmodelo/v0.5.0/questions.yaml +++ b/charts/portalmodelo/v0.5.0/questions.yaml @@ -44,6 +44,13 @@ questions: type: string group: Básico required: false +- variable: portal.addprefix + default: "" + description: "Prefixo adicional para a URL do Portal (opcional)" + label: Prefixo adicional do Host + type: string + group: Básico + required: false - variable: portal.rootPassword default: "altereme" description: "Senha de Admin do Zope (raiz, imutável)" diff --git a/charts/portalmodelo/v0.5.0/templates/ingress.yaml b/charts/portalmodelo/v0.5.0/templates/ingress.yaml index 49e31c8..8d61d31 100644 --- a/charts/portalmodelo/v0.5.0/templates/ingress.yaml +++ b/charts/portalmodelo/v0.5.0/templates/ingress.yaml @@ -2,6 +2,7 @@ {{- $fullName := include "portalmodelo.fullname" . -}} {{- $hostName := .Values.portal.hostname -}} {{- $hostPrefix := .Values.portal.hostprefix -}} +{{- $addPrefix := .Values.portal.addprefix -}} {{- $zopeFolder := .Values.portal.zopefolder -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 @@ -53,6 +54,9 @@ spec: - hosts: - "{{ $hostPrefix }}.{{ $hostName }}" - "{{ $hostName }}" + {{- if .Values.portal.addprefix }} + - "{{ $addPrefix }}.{{ $hostName }}" + {{- end }} secretName: {{ $hostName | replace "." "-" }}-tls {{- end }} rules: @@ -77,4 +81,27 @@ spec: backend: serviceName: {{ $fullName }}-plone servicePort: 8080 + {{- if .Values.portal.addprefix }} + - host: "{{ $addPrefix }}.{{ $hostName }}" + http: + paths: + {{- if and (contains "alb" .Values.ingress.class) (.Values.ingress.tls.enabled) }} + - path: /* + backend: + serviceName: ssl-redirect + servicePort: use-annotation + {{- end }} + {{- if contains "nginx" .Values.ingress.class }} + {{- if .Values.ingress.vhostmonster }} + - path: /(.*) + {{- else }} + - path: / + {{- end }} + {{- else }} + - path: /* + {{- end }} + backend: + serviceName: {{ $fullName }}-plone + servicePort: 8080 + {{- end }} {{- end }} diff --git a/charts/portalmodelo/v0.5.0/values.yaml b/charts/portalmodelo/v0.5.0/values.yaml index 64834d5..fcd3198 100644 --- a/charts/portalmodelo/v0.5.0/values.yaml +++ b/charts/portalmodelo/v0.5.0/values.yaml @@ -40,6 +40,7 @@ portal: description: Cidade - UF hostname: teste.df.leg.br hostprefix: www + addprefix: '' timeZone: America/Sao_Paulo createAndUpgrade: true zopefolder: '/'