diff --git a/helm/templates/05-ingress.yaml b/helm/templates/05-ingress.yaml index a064490..ad03406 100644 --- a/helm/templates/05-ingress.yaml +++ b/helm/templates/05-ingress.yaml @@ -1,8 +1,11 @@ {{- if and (not .Values.ingress.disabled) (not .Values.jobsOnly) -}} -{{- if (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }} +{{- $stableApi := .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress"}} +{{- if $stableApi -}} apiVersion: networking.k8s.io/v1 -{{- else }} +{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/Ingress" -}} apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: @@ -52,11 +55,11 @@ spec: http: paths: - path: {{ $.Values.ingress.path }} - {{- if ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }} + {{- if $stableApi }} pathType: Prefix {{- end }} backend: - {{- if ($.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }} + {{- if $stableApi }} service: name: {{ template "appname" $ }}-service port: