ingress.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {{- if .Values.server.ingress.enabled -}}
  2. {{- $ingressApiIsStable := eq (include "ingress.isStable" .) "true" -}}
  3. {{- $ingressSupportsIngressClassName := eq (include "ingress.supportsIngressClassName" .) "true" -}}
  4. {{- $ingressSupportsPathType := eq (include "ingress.supportsPathType" .) "true" -}}
  5. {{- $releaseName := .Release.Name -}}
  6. {{- $serviceName := include "prometheus.server.fullname" . }}
  7. {{- $servicePort := .Values.server.service.servicePort -}}
  8. {{- $ingressPath := .Values.server.ingress.path -}}
  9. {{- $ingressPathType := .Values.server.ingress.pathType -}}
  10. {{- $extraPaths := .Values.server.ingress.extraPaths -}}
  11. apiVersion: {{ template "ingress.apiVersion" . }}
  12. kind: Ingress
  13. metadata:
  14. {{- if .Values.server.ingress.annotations }}
  15. annotations:
  16. {{ toYaml .Values.server.ingress.annotations | indent 4 }}
  17. {{- end }}
  18. labels:
  19. {{- include "prometheus.server.labels" . | nindent 4 }}
  20. {{- range $key, $value := .Values.server.ingress.extraLabels }}
  21. {{ $key }}: {{ $value }}
  22. {{- end }}
  23. name: {{ template "prometheus.server.fullname" . }}
  24. {{ include "prometheus.namespace" . | indent 2 }}
  25. spec:
  26. {{- if and $ingressSupportsIngressClassName .Values.server.ingress.ingressClassName }}
  27. ingressClassName: {{ .Values.server.ingress.ingressClassName }}
  28. {{- end }}
  29. rules:
  30. {{- range .Values.server.ingress.hosts }}
  31. {{- $url := splitList "/" . }}
  32. - host: {{ first $url }}
  33. http:
  34. paths:
  35. {{ if $extraPaths }}
  36. {{ toYaml $extraPaths | indent 10 }}
  37. {{- end }}
  38. - path: {{ $ingressPath }}
  39. {{- if $ingressSupportsPathType }}
  40. pathType: {{ $ingressPathType }}
  41. {{- end }}
  42. backend:
  43. {{- if $ingressApiIsStable }}
  44. service:
  45. name: {{ $serviceName }}
  46. port:
  47. number: {{ $servicePort }}
  48. {{- else }}
  49. serviceName: {{ $serviceName }}
  50. servicePort: {{ $servicePort }}
  51. {{- end }}
  52. {{- end -}}
  53. {{- if .Values.server.ingress.tls }}
  54. tls:
  55. {{ toYaml .Values.server.ingress.tls | indent 4 }}
  56. {{- end -}}
  57. {{- end -}}