-
Notifications
You must be signed in to change notification settings - Fork 5k
/
servicemonitor.yaml
59 lines (59 loc) · 2.3 KB
/
servicemonitor.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{{- if .Values.serviceMonitor.enabled }}
{{- range .Values.serviceMonitor.targets }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ template "prometheus-blackbox-exporter.fullname" $ }}-{{ .name }}
namespace: {{ template "prometheus-blackbox-exporter.namespace" $ }}
labels:
{{- include "prometheus-blackbox-exporter.labels" $ | nindent 4 }}
{{- if or $.Values.serviceMonitor.defaults.labels .labels }}
{{- toYaml (.labels | default $.Values.serviceMonitor.defaults.labels) | nindent 4 }}
{{- end }}
spec:
endpoints:
- port: http
scheme: {{ $.Values.serviceMonitor.scheme }}
{{- if $.Values.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ $.Values.serviceMonitor.bearerTokenFile }}
{{- end }}
{{- if $.Values.serviceMonitor.tlsConfig }}
tlsConfig: {{ toYaml $.Values.serviceMonitor.tlsConfig | nindent 6 }}
{{- end }}
path: {{ $.Values.serviceMonitor.path }}
interval: {{ .interval | default $.Values.serviceMonitor.defaults.interval }}
scrapeTimeout: {{ .scrapeTimeout | default $.Values.serviceMonitor.defaults.scrapeTimeout }}
params:
module:
- {{ .module | default $.Values.serviceMonitor.defaults.module }}
target:
- {{ .url }}
{{- if .hostname }}
hostname:
- {{ .hostname }}
{{- end }}
metricRelabelings:
- sourceLabels: [instance]
targetLabel: instance
replacement: {{ .url }}
- sourceLabels: [target]
targetLabel: target
replacement: {{ .name }}
{{- range $targetLabel, $replacement := .additionalMetricsRelabels | default $.Values.serviceMonitor.defaults.additionalMetricsRelabels }}
- targetLabel: {{ $targetLabel | quote }}
replacement: {{ $replacement | quote }}
{{- end }}
{{- if concat (.additionalRelabeling | default list) $.Values.serviceMonitor.defaults.additionalRelabeling }}
relabelings:
{{ toYaml (concat (.additionalRelabeling | default list) $.Values.serviceMonitor.defaults.additionalRelabeling) | indent 6 }}
{{- end }}
jobLabel: "{{ $.Release.Name }}"
selector:
matchLabels:
{{- include "prometheus-blackbox-exporter.selectorLabels" $ | nindent 6 }}
namespaceSelector:
matchNames:
- {{ template "prometheus-blackbox-exporter.namespace" $ }}
{{- end }}
{{- end }}