From 80014450fab7ff73581b251b4ca2464f9bd66c50 Mon Sep 17 00:00:00 2001 From: Eric Meehan Date: Tue, 31 Mar 2026 19:06:56 -0400 Subject: [PATCH] Copied ingress template from Gitea helm chart --- mailman3/templates/ingress.yaml | 64 +++++++++++++++++++++++++-------- mailman3/values.yaml | 9 ++--- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/mailman3/templates/ingress.yaml b/mailman3/templates/ingress.yaml index b4f274e..21e1ea1 100644 --- a/mailman3/templates/ingress.yaml +++ b/mailman3/templates/ingress.yaml @@ -1,29 +1,63 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "mailman3.fullname" . -}} -{{- $svcPort := .Values.service.port -}} +{{- $httpPort := .Values.service.port -}} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ $fullName }} + namespace: {{ .Values.namespace | default .Release.Namespace }} labels: {{- include "mailman3.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} annotations: - {{- toYaml . | nindent 4 }} - {{- end }} + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} spec: - {{- if .Values.ingress.tls }} + ingressClassName: {{ tpl .Values.ingress.className . }} +{{- if .Values.ingress.tls }} tls: + {{- range .Values.ingress.tls }} - hosts: - - {{ .Values.hostname }} - secretName: {{ include "mailman3.fullname" . }}-certificate + {{- range .hosts }} + - {{ tpl . $ | quote }} + {{- end }} + secretName: {{ .secretName }} {{- end }} - rules: - - host: {{ .Values.hostname | quote }} - http: - paths: - - path: / - backend: - serviceName: {{ include "mailman3.fullname" . }}-web - servicePort: 80 {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ tpl .host $ | quote }} + http: + paths: + {{- if .paths }} + {{- range .paths }} + {{- if kindIs "string" . }} + - path: {{ . }} + pathType: {{ default "Prefix" $.Values.ingress.pathType }} + backend: + service: + name: {{ $fullName }}-http + port: + number: {{ $httpPort }} + {{- else }} + - path: {{ .path | default "/" }} + pathType: {{ .pathType | default "Prefix" }} + backend: + service: + name: {{ $fullName }}-http + port: + number: {{ $httpPort }} + {{- end }} + {{- end }} + {{- else }} + - path: "/" + pathType: "Prefix" + backend: + service: + name: {{ $fullName }}-http + port: + number: {{ $httpPort }} + {{- end }} + {{- end }} +{{- end }} + diff --git a/mailman3/values.yaml b/mailman3/values.yaml index d024ad4..5c141f2 100644 --- a/mailman3/values.yaml +++ b/mailman3/values.yaml @@ -70,9 +70,6 @@ service: ingress: enabled: false - tls: false - annotations: - # use NGINX Ingress Controller - #kubernetes.io/ingress.class: "nginx" - # use Cert-Manager for LetsEncrypt Certificates - #cert-manager.io/issuer: "letsencrypt-prod" + tls: [] + className: letsencrypt-prod + annotations: {}