Repository: provectus/kafka-ui
Issue: Make helm Ingress compatible with k8s v1.22+
Labels: type/enhancement
scope/infrastructure
scope/k8s

### Is your proposal related to a problem?
Can we change the ingress to make compatiable with k8s v1.22+
<!--
  Provide a clear and concise description of what the problem is.
  networking.k8s.io/v1beta1 Ingress is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
-->

(Write your answer here.)

### Describe the solution you'd like
Can we change the ingress to make compatiable with k8s v1.22+
<!--
  Provide a clear and concise description of what you want to happen.
-->

(Describe your proposed solution here.)

### Describe alternatives you've considered

<!--
  Let us know about other solutions you've tried or researched.
-->

(Write your answer here.)

### Additional context

<!--
  Is there anything else you can add about the proposal?
  You might want to link to related issues here, if you haven't already.
-->

(Write your answer here.)


Issue comments:
Hello there bahaeddinoz! 👋

Thank you and congratulations 🎉 for opening your very first issue in this project! 💖

In case you want to claim this issue, please comment down below! We will try to get back to you as soon as we can. 👀
Hey, thanks for reaching out. We'll take a look.
Thanks @Haarolean for the so quick updates 🙏 Just one question why directly didn't we use the "networking.k8s.io/v1 " and instead specified if k8s version is highter then 1.22 ? k8s supports it since v1.10. Can be good to use it directly or is there any other reason ?
https://kubernetes.io/docs/reference/using-api/deprecation-guide/#apiservice-v122
@bahaeddinoz first of all, your documentation says it's supported since 1.19, not 1.10 (`Migrate manifests and API clients to use the networking.k8s.io/v1 API version, available since v1.19.`). The main purpose is to save back compatibility.

Pull request review comments:

Patch that resolved the issue:
diff --git a/charts/kafka-ui/templates/ingress.yaml b/charts/kafka-ui/templates/ingress.yaml
index e602bb7471d..6c823c0ab05 100644
--- a/charts/kafka-ui/templates/ingress.yaml
+++ b/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 }}
\ No newline at end of file
+{{- end }}
+{{- end }}
\ No newline at end of file


Test patch: