blob: e245ad448e827187ecc8a0d1fdf42a7f37e975ba [file] [log] [blame]
Mohammed Naser9ad0d462023-01-15 20:36:37 -05001{{- if and .Values.thanosRuler.enabled .Values.thanosRuler.ingress.enabled }}
2{{- $pathType := .Values.thanosRuler.ingress.pathType | default "ImplementationSpecific" }}
Mohammed Naser5b49cbb2023-08-30 16:16:37 -04003{{- $serviceName := include "kube-prometheus-stack.thanosRuler.name" . }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05004{{- $servicePort := .Values.thanosRuler.service.port -}}
5{{- $routePrefix := list .Values.thanosRuler.thanosRulerSpec.routePrefix }}
6{{- $paths := .Values.thanosRuler.ingress.paths | default $routePrefix -}}
7{{- $apiIsStable := eq (include "kube-prometheus-stack.ingress.isStable" .) "true" -}}
8{{- $ingressSupportsPathType := eq (include "kube-prometheus-stack.ingress.supportsPathType" .) "true" -}}
9apiVersion: {{ include "kube-prometheus-stack.ingress.apiVersion" . }}
10kind: Ingress
11metadata:
12 name: {{ $serviceName }}
13 namespace: {{ template "kube-prometheus-stack.namespace" . }}
14{{- if .Values.thanosRuler.ingress.annotations }}
15 annotations:
Mohammed Naser91e2fa02024-02-23 01:46:39 -050016 {{- tpl (toYaml .Values.thanosRuler.ingress.annotations) . | nindent 4 }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050017{{- end }}
18 labels:
Mohammed Naser5b49cbb2023-08-30 16:16:37 -040019 app: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050020{{- if .Values.thanosRuler.ingress.labels }}
21{{ toYaml .Values.thanosRuler.ingress.labels | indent 4 }}
22{{- end }}
23{{ include "kube-prometheus-stack.labels" . | indent 4 }}
24spec:
25 {{- if $apiIsStable }}
26 {{- if .Values.thanosRuler.ingress.ingressClassName }}
27 ingressClassName: {{ .Values.thanosRuler.ingress.ingressClassName }}
28 {{- end }}
29 {{- end }}
30 rules:
31 {{- if .Values.thanosRuler.ingress.hosts }}
32 {{- range $host := .Values.thanosRuler.ingress.hosts }}
33 - host: {{ tpl $host $ }}
34 http:
35 paths:
36 {{- range $p := $paths }}
37 - path: {{ tpl $p $ }}
38 {{- if and $pathType $ingressSupportsPathType }}
39 pathType: {{ $pathType }}
40 {{- end }}
41 backend:
42 {{- if $apiIsStable }}
43 service:
44 name: {{ $serviceName }}
45 port:
46 number: {{ $servicePort }}
47 {{- else }}
48 serviceName: {{ $serviceName }}
49 servicePort: {{ $servicePort }}
50 {{- end }}
51 {{- end -}}
52 {{- end -}}
53 {{- else }}
54 - http:
55 paths:
56 {{- range $p := $paths }}
57 - path: {{ tpl $p $ }}
58 {{- if and $pathType $ingressSupportsPathType }}
59 pathType: {{ $pathType }}
60 {{- end }}
61 backend:
62 {{- if $apiIsStable }}
63 service:
64 name: {{ $serviceName }}
65 port:
66 number: {{ $servicePort }}
67 {{- else }}
68 serviceName: {{ $serviceName }}
69 servicePort: {{ $servicePort }}
70 {{- end }}
71 {{- end -}}
72 {{- end -}}
73 {{- if .Values.thanosRuler.ingress.tls }}
74 tls:
75{{ tpl (toYaml .Values.thanosRuler.ingress.tls | indent 4) . }}
76 {{- end -}}
77{{- end -}}