ingress.yaml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {{- if and .Values.pushgateway.enabled .Values.pushgateway.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.pushgateway.fullname" . }}
  7. {{- $servicePort := .Values.pushgateway.service.servicePort -}}
  8. {{- $ingressPath := .Values.pushgateway.ingress.path -}}
  9. {{- $ingressPathType := .Values.pushgateway.ingress.pathType -}}
  10. {{- $extraPaths := .Values.pushgateway.ingress.extraPaths -}}
  11. apiVersion: {{ template "ingress.apiVersion" . }}
  12. kind: Ingress
  13. metadata:
  14. {{- if .Values.pushgateway.ingress.annotations }}
  15. annotations:
  16. {{ toYaml .Values.pushgateway.ingress.annotations | indent 4}}
  17. {{- end }}
  18. labels:
  19. {{- include "prometheus.pushgateway.labels" . | nindent 4 }}
  20. name: {{ template "prometheus.pushgateway.fullname" . }}
  21. {{ include "prometheus.namespace" . | indent 2 }}
  22. spec:
  23. {{- if and $ingressSupportsIngressClassName .Values.pushgateway.ingress.ingressClassName }}
  24. ingressClassName: {{ .Values.pushgateway.ingress.ingressClassName }}
  25. {{- end }}
  26. rules:
  27. {{- range .Values.pushgateway.ingress.hosts }}
  28. {{- $url := splitList "/" . }}
  29. - host: {{ first $url }}
  30. http:
  31. paths:
  32. {{ if $extraPaths }}
  33. {{ toYaml $extraPaths | indent 10 }}
  34. {{- end }}
  35. - path: {{ $ingressPath }}
  36. {{- if $ingressSupportsPathType }}
  37. pathType: {{ $ingressPathType }}
  38. {{- end }}
  39. backend:
  40. {{- if $ingressApiIsStable }}
  41. service:
  42. name: {{ $serviceName }}
  43. port:
  44. number: {{ $servicePort }}
  45. {{- else }}
  46. serviceName: {{ $serviceName }}
  47. servicePort: {{ $servicePort }}
  48. {{- end }}
  49. {{- end -}}
  50. {{- if .Values.pushgateway.ingress.tls }}
  51. tls:
  52. {{ toYaml .Values.pushgateway.ingress.tls | indent 4 }}
  53. {{- end -}}
  54. {{- end -}}