1+ {{- if .Values.gatewayapi.enabled -}}
2+ {{- $fullName := include "mailhog.fullname" . -}}
3+ {{- if .Values.gatewayapi.tls }}
4+ ---
5+ apiVersion : gateway.networking.k8s.io/v1
6+ kind : HTTPRoute
7+ metadata :
8+ name : {{ printf "%s-redirect" $fullName }}
9+ namespace : {{ .Release.Namespace | quote }}
10+ labels :
11+ {{- include "mailhog.labels" . | nindent 4 }}
12+ {{- with .Values.gatewayapi.labels }}
13+ {{- toYaml . | nindent 4 }}
14+ {{- end }}
15+ spec :
16+ parentRefs :
17+ - group : gateway.networking.k8s.io
18+ kind : ListenerSet
19+ name : {{ $fullName }}
20+ namespace : {{ .Release.Namespace | quote }}
21+ sectionName : {{ printf "%s-http" $fullName }}
22+ hostnames :
23+ {{- range .Values.gatewayapi.hosts }}
24+ - {{ .host | quote }}
25+ {{- end }}
26+ rules :
27+ - filters :
28+ - type : RequestRedirect
29+ requestRedirect :
30+ scheme : https
31+ statusCode : 301
32+ ---
33+ apiVersion : gateway.networking.k8s.io/v1
34+ kind : HTTPRoute
35+ metadata :
36+ name : {{ $fullName }}
37+ namespace : {{ .Release.Namespace | quote }}
38+ labels :
39+ {{- include "mailhog.labels" . | nindent 4 }}
40+ {{- with .Values.gatewayapi.labels }}
41+ {{- toYaml . | nindent 4 }}
42+ {{- end }}
43+ {{- with .Values.gatewayapi.annotations }}
44+ annotations :
45+ {{- toYaml . | nindent 4 }}
46+ {{- end }}
47+ spec :
48+ parentRefs :
49+ - group : gateway.networking.k8s.io
50+ kind : ListenerSet
51+ name : {{ $fullName }}
52+ namespace : {{ .Release.Namespace | quote }}
53+ sectionName : {{ printf "%s-https" $fullName }}
54+ hostnames :
55+ {{- range .Values.gatewayapi.hosts }}
56+ - {{ .host | quote }}
57+ {{- end }}
58+ rules :
59+ {{- range .Values.gatewayapi.hosts }}
60+ {{- range .paths }}
61+ - matches :
62+ - path :
63+ type : {{ .pathType | default "PathPrefix" }}
64+ value : {{ .path }}
65+ backendRefs :
66+ - name : {{ $fullName }}
67+ port : 8025
68+ {{- end }}
69+ {{- end }}
70+ {{- else }}
71+ ---
72+ apiVersion : gateway.networking.k8s.io/v1
73+ kind : HTTPRoute
74+ metadata :
75+ name : {{ $fullName }}
76+ namespace : {{ .Release.Namespace | quote }}
77+ labels :
78+ {{- include "mailhog.labels" . | nindent 4 }}
79+ {{- with .Values.gatewayapi.labels }}
80+ {{- toYaml . | nindent 4 }}
81+ {{- end }}
82+ {{- with .Values.gatewayapi.annotations }}
83+ annotations :
84+ {{- toYaml . | nindent 4 }}
85+ {{- end }}
86+ spec :
87+ parentRefs :
88+ - group : gateway.networking.k8s.io
89+ kind : ListenerSet
90+ name : {{ $fullName }}
91+ namespace : {{ .Release.Namespace | quote }}
92+ sectionName : {{ printf "%s-http" $fullName }}
93+ hostnames :
94+ {{- range .Values.gatewayapi.hosts }}
95+ - {{ .host | quote }}
96+ {{- end }}
97+ rules :
98+ {{- range .Values.gatewayapi.hosts }}
99+ {{- range .paths }}
100+ - matches :
101+ - path :
102+ type : {{ .pathType | default "PathPrefix" }}
103+ value : {{ .path }}
104+ backendRefs :
105+ - name : {{ $fullName }}
106+ port : 8025
107+ {{- end }}
108+ {{- end }}
109+ {{- end }}
110+ {{- end }}
0 commit comments