Skip to content

Commit 9399400

Browse files
moray95Mirco Hacker
authored andcommitted
[mailhog] add support for ingress v1
Signed-off-by: Moray Baruh <[email protected]>
1 parent a64ea8a commit 9399400

File tree

5 files changed

+58
-5
lines changed

5 files changed

+58
-5
lines changed

charts/mailhog/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
description: An e-mail testing tool for developers
33
name: mailhog
44
appVersion: v1.0.1
5-
version: 4.1.0
5+
version: 5.0.0
66
type: application
77
keywords:
88
- mailhog

charts/mailhog/README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,36 @@ Parameter | Description | Default
7171
`ingress.enabled` | If `true`, an ingress is created | `false`
7272
`ingress.annotations` | Annotations for the ingress | `{}`
7373
`ingress.labels` | Labels for the ingress | `{}`
74-
`ingress.hosts` | A list of ingress hosts | `{ host: mailhog.example.com, paths: ["/"] }`
74+
`ingress.hosts` | A list of ingress hosts | `{ host: mailhog.example.com, paths: [{ path: "/", pathType: Prefix }] }`
7575
`ingress.tls` | A list of [IngressTLS](https://v1-8.docs.kubernetes.io/docs/api-reference/v1.8/#ingresstls-v1beta1-extensions) items | `[]`
7676
`extraEnv` | Additional environment variables, see [CONFIG.md](https://github.com/mailhog/MailHog/blob/master/docs/CONFIG.md) | `{}`
77+
78+
## Upgrading
79+
80+
### From chart < 5.0.0
81+
82+
Ingress path definitions are extended to describe path and pathType. Previously only the path was configured. Please adapt your configuration as shown below:
83+
84+
Old:
85+
```yaml
86+
ingress:
87+
# ...
88+
hosts:
89+
- host: mailhog.example.com
90+
# Paths for the host
91+
paths:
92+
- /
93+
```
94+
New:
95+
```yaml
96+
ingress:
97+
# ...
98+
hosts:
99+
- host: mailhog.example.com
100+
# Paths for the host
101+
paths:
102+
- path: /
103+
pathType: Prefix
104+
```
105+
106+
This allows to configure specific `pathType` configurations, e.g. `pathType: ImplementationSpecific` for [GKE Ingress on Google Cloud Platform](https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#default_backend).

charts/mailhog/templates/_helpers.tpl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,14 @@ Create the name for the outgoing-smtp secret.
8181
{{- template "mailhog.fullname" . -}}-outgoing-smtp
8282
{{- end -}}
8383
{{- end -}}
84+
85+
{{/*
86+
Return the appropriate apiVersion for ingress.
87+
*/}}
88+
{{- define "mailhog.ingressAPIVersion" -}}
89+
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}}
90+
{{- print "networking.k8s.io/v1" -}}
91+
{{- else -}}
92+
{{- print "networking.k8s.io/v1beta1" -}}
93+
{{- end -}}
94+
{{- end -}}

charts/mailhog/templates/ingress.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "mailhog.fullname" . -}}
3-
apiVersion: networking.k8s.io/v1beta1
3+
apiVersion: {{ include "mailhog.ingressAPIVersion" . }}
44
kind: Ingress
55
metadata:
66
name: {{ $fullName }}
@@ -33,10 +33,19 @@ spec:
3333
http:
3434
paths:
3535
{{- range .paths }}
36-
- path: {{ . }}
36+
- path: {{ .path }}
37+
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
38+
pathType: {{ .pathType }}
39+
backend:
40+
service:
41+
name: {{ $fullName }}
42+
port:
43+
name: http
44+
{{- else }}
3745
backend:
3846
serviceName: {{ $fullName }}
3947
servicePort: http
48+
{{- end }}
4049
{{- end }}
4150
{{- end }}
4251
{{- end }}

charts/mailhog/values.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ ingress:
5555
labels: {}
5656
hosts:
5757
- host: mailhog.example.com
58-
paths: ["/"]
58+
paths:
59+
- path: "/"
60+
pathType: Prefix
61+
5962

6063
tls: []
6164
# - secretName: chart-example-tls

0 commit comments

Comments
 (0)