{{- if and .Values.prometheus.enabled .Values.prometheus.thanosIngress.enabled }} {{- $serviceName := printf "%s-%s" (include "kube-prometheus-stack.fullname" .) "prometheus" }} {{- $thanosPort := .Values.prometheus.thanosIngress.servicePort -}} {{- $routePrefix := list .Values.prometheus.prometheusSpec.routePrefix }} {{- $paths := .Values.prometheus.thanosIngress.paths | default $routePrefix -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: {{- if .Values.prometheus.thanosIngress.annotations }} annotations: {{ toYaml .Values.prometheus.thanosIngress.annotations | indent 4 }} {{- end }} name: {{ template "kube-prometheus-stack.fullname" . }}-thanos-gateway labels: app: {{ template "kube-prometheus-stack.name" . }}-prometheus {{ include "kube-prometheus-stack.labels" . | indent 4 }} {{- if .Values.prometheus.thanosIngress.labels }} {{ toYaml .Values.prometheus.thanosIngress.labels | indent 4 }} {{- end }} spec: rules: {{- if .Values.prometheus.thanosIngress.hosts }} {{- range $host := .Values.prometheus.thanosIngress.hosts }} - host: {{ tpl $host $ }} http: paths: {{- range $p := $paths }} - path: {{ tpl $p $ }} backend: serviceName: {{ $serviceName }} servicePort: {{ $thanosPort }} {{- end -}} {{- end -}} {{- else }} - http: paths: {{- range $p := $paths }} - path: {{ tpl $p $ }} backend: serviceName: {{ $serviceName }} servicePort: {{ $thanosPort }} {{- end -}} {{- end -}} {{- if .Values.prometheus.thanosIngress.tls }} tls: {{ toYaml .Values.prometheus.thanosIngress.tls | indent 4 }} {{- end -}} {{- end -}}