enhancement to support ingress api 1.22+ (#1345)

This commit is contained in:
Ruslan Ibragimov 2021-12-30 12:02:50 +03:00 committed by GitHub
parent d87c2a5290
commit 269ace82e1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,10 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "kafka-ui.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else if semverCompare ">=1.22-0" .Capabilities.KubeVersion.GitVersion -}}
{{- if semverCompare ">=1.22-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 }}
@ -27,6 +27,37 @@ spec:
rules:
- http:
paths:
{{- if semverCompare ">=1.22-0" .Capabilities.KubeVersion.GitVersion -}}
{{- range .Values.ingress.precedingPaths }}
- path: {{ .path }}
pathType: ImplementationSpecific
backend:
service:
name: {{ .serviceName }}
port:
number: {{ .servicePort }}
{{- end }}
- backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- if .Values.ingress.path }}
path: {{ .Values.ingress.path }}
{{- end }}
{{- range .Values.ingress.succeedingPaths }}
- path: {{ .path }}
pathType: ImplementationSpecific
backend:
service:
name: {{ .serviceName }}
port:
number: {{ .servicePort }}
{{- end }}
{{- if .Values.ingress.host }}
host: {{ .Values.ingress.host }}
{{- end }}
{{- else -}}
{{- range .Values.ingress.precedingPaths }}
- path: {{ .path }}
backend:
@ -48,4 +79,5 @@ spec:
{{- if .Values.ingress.host }}
host: {{ .Values.ingress.host }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}