{{- if .Values.ui.enabled }} {{- if .Values.ui.ingress.enabled }} {{- $uiFullName := include "kafka.ui.fullname" . }} {{- if and .Values.ui.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} {{- if not (hasKey .Values.ui.ingress.annotations "kubernetes.io/ingress.class") }} {{- $_ := set .Values.ui.ingress.annotations "kubernetes.io/ingress.class" .Values.ui.ingress.className}} {{- end }} {{- end }} {{- 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: {{ $uiFullName }} labels: {{- include "kafka.labels" . | nindent 4 }} {{- with .Values.ui.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: {{- if and .Values.ui.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} ingressClassName: {{ .Values.ui.ingress.className }} {{- end }} {{- if .Values.ui.ingress.tls }} tls: {{- range .Values.ui.ingress.tls }} - hosts: {{- range .hosts }} - {{ . | quote }} {{- end }} secretName: {{ .secretName }} {{- end }} {{- end }} rules: {{- range .Values.ui.ingress.hosts }} - host: {{ .host | quote }} http: paths: - path: / pathType: Prefix backend: {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} service: name: {{ $uiFullName }} port: number: 8080 {{- else }} serviceName: {{ $uiFullName }} servicePort: 8080 {{- end }} {{- end }} {{- end }} {{- end }}