rancher-charts/charts/rancher-monitoring/103.1.0+up45.31.1/templates/thanos-ruler/servicemonitor.yaml

61 lines
2.5 KiB
YAML

{{- if and .Values.thanosRuler.enabled .Values.thanosRuler.serviceMonitor.selfMonitor }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
namespace: {{ template "kube-prometheus-stack.namespace" . }}
labels:
app: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
{{- with .Values.thanosRuler.serviceMonitor.additionalLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- include "servicemonitor.scrapeLimits" .Values.thanosRuler.serviceMonitor | nindent 2 }}
selector:
matchLabels:
app: {{ template "kube-prometheus-stack.thanosRuler.name" . }}
release: {{ $.Release.Name | quote }}
self-monitor: {{ .Values.thanosRuler.serviceMonitor.selfMonitor | quote }}
namespaceSelector:
matchNames:
- {{ printf "%s" (include "kube-prometheus-stack.namespace" .) | quote }}
endpoints:
- port: {{ .Values.thanosRuler.thanosRulerSpec.portName }}
{{- if .Values.thanosRuler.serviceMonitor.interval }}
interval: {{ .Values.thanosRuler.serviceMonitor.interval }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.proxyUrl }}
proxyUrl: {{ .Values.thanosRuler.serviceMonitor.proxyUrl}}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.scheme }}
scheme: {{ .Values.thanosRuler.serviceMonitor.scheme }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.thanosRuler.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml .Values.thanosRuler.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
path: "{{ trimSuffix "/" .Values.thanosRuler.thanosRulerSpec.routePrefix }}/metrics"
metricRelabelings:
{{- if .Values.thanosRuler.serviceMonitor.metricRelabelings }}
{{ tpl (toYaml .Values.thanosRuler.serviceMonitor.metricRelabelings | indent 6) . }}
{{- end }}
{{ if .Values.global.cattle.clusterId }}
- sourceLabels: [__address__]
targetLabel: cluster_id
replacement: {{ .Values.global.cattle.clusterId }}
{{- end }}
{{ if .Values.global.cattle.clusterName}}
- sourceLabels: [__address__]
targetLabel: cluster_name
replacement: {{ .Values.global.cattle.clusterName }}
{{- end }}
{{- if .Values.thanosRuler.serviceMonitor.relabelings }}
relabelings:
{{ toYaml .Values.thanosRuler.serviceMonitor.relabelings | indent 6 }}
{{- end }}
{{- end }}