diff --git a/chart/templates/ingress.yaml b/chart/templates/ingress.yaml index c3612591ba..bdcf93989c 100644 --- a/chart/templates/ingress.yaml +++ b/chart/templates/ingress.yaml @@ -1,5 +1,11 @@ {{- if .Values.ingress.enabled -}} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} apiVersion: extensions/v1beta1 +{{- end }} kind: Ingress metadata: name: {{ include "common.names.fullname" . }} @@ -15,6 +21,9 @@ metadata: {{ $key }}: {{ include "common.tplvalues.render" (dict "value" $value "context" $) | quote }} {{- end }} spec: +{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} +{{- end }} {{- if .Values.ingress.tls }} tls: {{- range .Values.ingress.tls }} @@ -31,12 +40,32 @@ spec: http: paths: - path: /api/ + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: Prefix + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ include "common.names.fullname" $ }} + port: + name: http + {{- else }} serviceName: {{ include "common.names.fullname" $ }} servicePort: http + {{- end }} - path: / + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: Prefix + {{- end }} backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ include "common.names.fullname" $ }}-web + port: + name: http + {{- else }} serviceName: {{ include "common.names.fullname" $ }}-web servicePort: http + {{- end }} {{- end }} {{- end }}