ingress.yaml 1.8 KB

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