Skip to content

Commit 3c09f5c

Browse files
sewielandMirco Hacker
authored andcommitted
Change Ingress Api Version Logic
Signed-off-by: sewieland <[email protected]>
1 parent 7673c62 commit 3c09f5c

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
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: 5.0.1
5+
version: 5.0.2
66
type: application
77
keywords:
88
- mailhog

charts/mailhog/templates/_helpers.tpl

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,3 @@ 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: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
{{- if .Values.ingress.enabled -}}
22
{{- $fullName := include "mailhog.fullname" . -}}
3-
apiVersion: {{ include "mailhog.ingressAPIVersion" . }}
3+
{{- $apiV1 := false -}}
4+
{{- $apiVersion := "extensions/v1beta1" -}}
5+
{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= v1.19.0-0" .Capabilities.KubeVersion.Version) -}}
6+
{{- $apiVersion = "networking.k8s.io/v1" -}}
7+
{{- $apiV1 = true -}}
8+
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
9+
{{- $apiVersion = "networking.k8s.io/v1beta1" -}}
10+
{{- else -}}
11+
{{- $apiVersion = "extensions/v1beta1" -}}
12+
{{- end }}
13+
apiVersion: {{ $apiVersion }}
414
kind: Ingress
515
metadata:
616
name: {{ $fullName }}
@@ -37,7 +47,7 @@ spec:
3747
paths:
3848
{{- range .paths }}
3949
- path: {{ .path }}
40-
{{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
50+
{{- if $apiV1 }}
4151
pathType: {{ .pathType }}
4252
backend:
4353
service:

0 commit comments

Comments
 (0)