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.

58 lines
1.9 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 .Values.ingress.tls }}
  27. tls:
  28. {{- range .Values.ingress.tls }}
  29. - hosts:
  30. {{- range .hosts }}
  31. - {{ . | quote }}
  32. {{- end }}
  33. secretName: {{ .secretName }}
  34. {{- end }}
  35. {{- end }}
  36. rules:
  37. {{- range .Values.ingress.hosts }}
  38. - host: {{ .host | quote }}
  39. http:
  40. paths:
  41. {{- range .paths }}
  42. - path: {{ .path }}
  43. {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
  44. pathType: {{ .pathType }}
  45. {{- end }}
  46. backend:
  47. {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
  48. service:
  49. name: {{ $fullName }}
  50. port:
  51. number: {{ $svcPort }}
  52. {{- else }}
  53. serviceName: {{ $fullName }}
  54. servicePort: {{ $svcPort }}
  55. {{- end }}
  56. {{- end }}
  57. {{- end }}
  58. {{- end }}