Skip to content

Commit

Permalink
Add rule servicemonitor template
Browse files Browse the repository at this point in the history
  • Loading branch information
boernd authored and tarokkk committed Mar 3, 2020
1 parent 253f4c2 commit 2fe993a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions thanos/templates/rule-servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if and .Values.rule.enabled .Values.rule.metrics.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "thanos.componentname" (list $ "rule") }}
labels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
helm.sh/chart: {{ include "thanos.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/version: {{ .Chart.AppVersion | replace "+" "_" }}
app.kubernetes.io/component: rule
{{ with .Values.rule.metrics.serviceMonitor.labels }}{{ toYaml . | indent 4 }}{{ end }}
spec:
jobLabel: thanos-rule
selector:
matchLabels:
app.kubernetes.io/name: {{ include "thanos.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/component: rule
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: http
interval: {{ .Values.rule.metrics.serviceMonitor.interval | default "15s" }}
{{- with .Values.rule.metrics.serviceMonitor.relabellings }}
metricRelabelings: {{ toYaml . | nindent 8 }}
{{- end }}
{{- end -}}

0 comments on commit 2fe993a

Please sign in to comment.