From e735dd5907e626d31533c2b6244f212be5e11a3d Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Fri, 6 Nov 2020 15:34:19 -0300 Subject: [PATCH] Added edemocracia.hostname parameter, easing ingress configuration --- charts/edemocracia/v0.4.0/questions.yaml | 2 +- .../edemocracia/v0.4.0/templates/ingress.yaml | 22 ++++++------------- charts/edemocracia/v0.4.0/values.yaml | 13 ++--------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/charts/edemocracia/v0.4.0/questions.yaml b/charts/edemocracia/v0.4.0/questions.yaml index 7d1ecfd..ef5cc8a 100644 --- a/charts/edemocracia/v0.4.0/questions.yaml +++ b/charts/edemocracia/v0.4.0/questions.yaml @@ -12,7 +12,7 @@ questions: group: Básico required: true - variable: edemocracia.hostname - default: "sapl.teste.df.leg.br" + default: "edemocracia.teste.df.leg.br" description: "Endereço para acesso ao E-democracia" label: "URL do SAPL" type: string diff --git a/charts/edemocracia/v0.4.0/templates/ingress.yaml b/charts/edemocracia/v0.4.0/templates/ingress.yaml index 8edfec0..94b3425 100644 --- a/charts/edemocracia/v0.4.0/templates/ingress.yaml +++ b/charts/edemocracia/v0.4.0/templates/ingress.yaml @@ -1,7 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "edemocracia.fullname" . -}} -{{- $svcPort := .Values.nginx.service.port -}} -{{- $ingressPath := .Values.ingress.path -}} +{{- $hostName := .Values.edemocracia.hostname -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} @@ -12,29 +11,22 @@ metadata: name: {{ $fullName }} labels: {{- include "edemocracia.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + {{- with .Values.ingress.annotations }} {{- toYaml . | nindent 4 }} {{- end }} spec: -{{- if .Values.ingress.tls }} tls: - {{- range .Values.ingress.tls }} - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} -{{- end }} + - "{{ $hostName }}" + secretName: {{ $hostName | replace "." "-" }}-tls rules: - {{- range .Values.ingress.hosts }} - - host: {{ . | quote }} + - host: "{{ $hostName }}" http: paths: - - path: {{ $ingressPath }} + - path: / backend: serviceName: nginx servicePort: http - {{- end }} {{- end }} diff --git a/charts/edemocracia/v0.4.0/values.yaml b/charts/edemocracia/v0.4.0/values.yaml index a461b7a..3b01cea 100644 --- a/charts/edemocracia/v0.4.0/values.yaml +++ b/charts/edemocracia/v0.4.0/values.yaml @@ -82,6 +82,7 @@ edemocracia: key: "" secret: "" siteName: "Camara Municipal" + hostname: "edemocracia.teste.df.leg.br" timeZone: "America/Sao_Paulo" image: repository: labhackercd/edemocracia @@ -174,20 +175,10 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" - ingress: enabled: true + # extra annotations only annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - path: / - hosts: - - chart-example.local - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - nodeSelector: {}