You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.0 KiB

  1. {{- if .Values.ingress.enabled -}}
  2. {{- $fullName := include "wiki.fullname" . -}}
  3. {{- $svcPort := .Values.service.port -}}
  4. {{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
  5. {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
  6. {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.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: {{ $fullName }}
  19. labels:
  20. {{- include "wiki.labels" . | nindent 4 }}
  21. {{- with .Values.ingress.annotations }}
  22. annotations:
  23. {{- toYaml . | nindent 4 }}
  24. {{- end }}
  25. spec:
  26. {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
  27. ingressClassName: {{ .Values.ingress.className }}
  28. {{- end }}
  29. {{- if .Values.ingress.tls }}
  30. tls:
  31. {{- range .Values.ingress.tls }}
  32. - hosts:
  33. {{- range .hosts }}
  34. - {{ . | quote }}
  35. {{- end }}
  36. secretName: {{ .secretName }}
  37. {{- end }}
  38. {{- end }}
  39. rules:
  40. {{- range .Values.ingress.hosts }}
  41. - host: {{ .host | quote }}
  42. http:
  43. paths:
  44. {{- range .paths }}
  45. - path: {{ .path }}
  46. {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
  47. pathType: {{ .pathType }}
  48. {{- end }}
  49. backend:
  50. {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
  51. service:
  52. name: {{ $fullName }}
  53. port:
  54. number: {{ $svcPort }}
  55. {{- else }}
  56. serviceName: {{ $fullName }}
  57. servicePort: {{ $svcPort }}
  58. {{- end }}
  59. {{- end }}
  60. {{- end }}
  61. {{- end }}