ingress.yaml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. {{- if .Values.ui.enabled }}
  2. {{- if .Values.ui.ingress.enabled }}
  3. {{- $uiFullName := include "kafka.ui.fullname" . }}
  4. {{- if and .Values.ui.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
  5. {{- if not (hasKey .Values.ui.ingress.annotations "kubernetes.io/ingress.class") }}
  6. {{- $_ := set .Values.ui.ingress.annotations "kubernetes.io/ingress.class" .Values.ui.ingress.className}}
  7. {{- end }}
  8. {{- end }}
  9. {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
  10. apiVersion: networking.k8s.io/v1
  11. {{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
  12. apiVersion: networking.k8s.io/v1beta1
  13. {{- else -}}
  14. apiVersion: extensions/v1beta1
  15. {{- end }}
  16. kind: Ingress
  17. metadata:
  18. name: {{ $uiFullName }}
  19. labels:
  20. {{- include "kafka.labels" . | nindent 4 }}
  21. {{- with .Values.ui.ingress.annotations }}
  22. annotations:
  23. {{- toYaml . | nindent 4 }}
  24. {{- end }}
  25. spec:
  26. {{- if and .Values.ui.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
  27. ingressClassName: {{ .Values.ui.ingress.className }}
  28. {{- end }}
  29. {{- if .Values.ui.ingress.tls }}
  30. tls:
  31. {{- range .Values.ui.ingress.tls }}
  32. - hosts:
  33. {{- range .hosts }}
  34. - {{ . | quote }}
  35. {{- end }}
  36. secretName: {{ .secretName }}
  37. {{- end }}
  38. {{- end }}
  39. rules:
  40. {{- range .Values.ui.ingress.hosts }}
  41. - host: {{ .host | quote }}
  42. http:
  43. paths:
  44. - path: /
  45. pathType: Prefix
  46. backend:
  47. {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
  48. service:
  49. name: {{ $uiFullName }}
  50. port:
  51. number: 8080
  52. {{- else }}
  53. serviceName: {{ $uiFullName }}
  54. servicePort: 8080
  55. {{- end }}
  56. {{- end }}
  57. {{- end }}
  58. {{- end }}