diff --git a/charts/mailhog/Chart.yaml b/charts/mailhog/Chart.yaml index d7395f6d..08c28a1f 100644 --- a/charts/mailhog/Chart.yaml +++ b/charts/mailhog/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 description: An e-mail testing tool for developers name: mailhog appVersion: v1.0.1 -version: 5.0.1 +version: 5.0.2 type: application keywords: - mailhog diff --git a/charts/mailhog/templates/_helpers.tpl b/charts/mailhog/templates/_helpers.tpl index 41849f86..64897b5c 100644 --- a/charts/mailhog/templates/_helpers.tpl +++ b/charts/mailhog/templates/_helpers.tpl @@ -81,14 +81,3 @@ Create the name for the outgoing-smtp secret. {{- template "mailhog.fullname" . -}}-outgoing-smtp {{- end -}} {{- end -}} - -{{/* -Return the appropriate apiVersion for ingress. -*/}} -{{- define "mailhog.ingressAPIVersion" -}} -{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" -}} -{{- print "networking.k8s.io/v1" -}} -{{- else -}} -{{- print "networking.k8s.io/v1beta1" -}} -{{- end -}} -{{- end -}} diff --git a/charts/mailhog/templates/ingress.yaml b/charts/mailhog/templates/ingress.yaml index d4a2bf6e..3cbc60d5 100644 --- a/charts/mailhog/templates/ingress.yaml +++ b/charts/mailhog/templates/ingress.yaml @@ -1,6 +1,16 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "mailhog.fullname" . -}} -apiVersion: {{ include "mailhog.ingressAPIVersion" . }} +{{- $apiV1 := false -}} +{{- $apiVersion := "extensions/v1beta1" -}} +{{- if and (.Capabilities.APIVersions.Has "networking.k8s.io/v1") (semverCompare ">= v1.19.0-0" .Capabilities.KubeVersion.Version) -}} + {{- $apiVersion = "networking.k8s.io/v1" -}} + {{- $apiV1 = true -}} +{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}} + {{- $apiVersion = "networking.k8s.io/v1beta1" -}} +{{- else -}} + {{- $apiVersion = "extensions/v1beta1" -}} +{{- end }} +apiVersion: {{ $apiVersion }} kind: Ingress metadata: name: {{ $fullName }} @@ -37,7 +47,7 @@ spec: paths: {{- range .paths }} - path: {{ .path }} - {{- if $.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }} + {{- if $apiV1 }} pathType: {{ .pathType }} backend: service: