Ver Fonte

enhancement to support ingress api 1.22+ (#1345)

Ruslan Ibragimov há 3 anos atrás
pai
commit
269ace82e1
1 ficheiros alterados com 36 adições e 4 exclusões
  1. 36 4
      charts/kafka-ui/templates/ingress.yaml

+ 36 - 4
charts/kafka-ui/templates/ingress.yaml

@@ -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 }}