-
Notifications
You must be signed in to change notification settings - Fork 582
Expand file tree
/
Copy pathservicemonitor.yaml
More file actions
122 lines (122 loc) · 3.89 KB
/
Copy pathservicemonitor.yaml
File metadata and controls
122 lines (122 loc) · 3.89 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{{ $serviceMonitorEnabled := include "serviceMonitorEnabled" . }}
{{- if eq "true" $serviceMonitorEnabled -}}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- if .Values.servicemonitor.name }}
name: {{ .Values.servicemonitor.name }}
{{- else }}
name: {{ template ".Chart.Name .fullname" . }}-sm
{{- end }}
labels:
kind: Prometheus
appId: {{ $.Values.app | quote }}
envId: {{ $.Values.env | quote }}
app: {{ template ".Chart.Name .name" $ }}
chart: {{ template ".Chart.Name .chart" $ }}
release: {{ .Values.prometheus.release }}
{{- if .Values.servicemonitor.additionalLabels }}
{{ toYaml .Values.servicemonitor.additionalLabels | indent 4 }}
{{- end }}
spec:
endpoints:
{{- range .Values.ContainerPort }}
{{- if .servicemonitor }}
{{- if .servicemonitor.enabled}}
{{- if .servicemonitor.targetPort }}
- targetPort: {{ .servicemonitor.targetPort }}
{{- else if .servicePort }}
- port: {{ .name }}
{{- end }}
{{- if .servicemonitor.path }}
path: {{ .servicemonitor.path}}
{{- end }}
{{- if .servicemonitor.scheme }}
scheme: {{ .servicemonitor.scheme}}
{{- end }}
{{- if .servicemonitor.interval }}
interval: {{ .servicemonitor.interval}}
{{- end }}
{{- if .servicemonitor.scrapeTimeout }}
scrapeTimeout: {{ .servicemonitor.scrapeTimeout | quote}}
{{- end }}
{{- if .servicemonitor.basicAuth }}
basicAuth:
{{- toYaml .servicemonitor.basicAuth | nindent 8 }}
{{- end }}
{{- if .servicemonitor.insecureTLS }}
tlsConfig:
insecureSkipVerify: true
{{- else if .servicemonitor.tlsConfig }}
tlsConfig:
{{- toYaml .servicemonitor.tlsConfig | nindent 8 }}
{{- end }}
{{- if .servicemonitor.metricRelabelings}}
metricRelabelings:
{{toYaml .servicemonitor.metricRelabelings | indent 8 }}
{{- end }}
{{- if .servicemonitor.relabelings }}
relabelings:
{{ toYaml .servicemonitor.relabelings | indent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- range .Values.containers }}
{{- range .ports }}
{{- if .servicemonitor }}
{{- if .servicemonitor.enabled}}
{{- if .servicemonitor.targetPort }}
- targetPort: {{ .servicemonitor.targetPort }}
{{- else if .servicePort }}
- port: {{ .name }}
{{- end }}
{{- if .servicemonitor.path }}
path: {{ .servicemonitor.path}}
{{- end }}
{{- if .servicemonitor.scheme }}
scheme: {{ .servicemonitor.scheme}}
{{- end }}
{{- if .servicemonitor.interval }}
interval: {{ .servicemonitor.interval}}
{{- end }}
{{- if .servicemonitor.scrapeTimeout }}
scrapeTimeout: {{ .servicemonitor.scrapeTimeout}}
{{- end }}
{{- if .servicemonitor.basicAuth }}
basicAuth:
{{- toYaml .servicemonitor.basicAuth | nindent 8 }}
{{- end }}
{{- if .servicemonitor.insecureTLS }}
tlsConfig:
insecureSkipVerify: true
{{- else if .servicemonitor.tlsConfig }}
tlsConfig:
{{- toYaml .servicemonitor.tlsConfig | nindent 8 }}
{{- end }}
{{- if .servicemonitor.metricRelabelings}}
metricRelabelings:
{{toYaml .servicemonitor.metricRelabelings | indent 8 }}
{{- end }}
{{- if .servicemonitor.relabelings }}
relabelings:
{{ toYaml .servicemonitor.relabelings | indent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.servicemonitor.namespaceSelector }}
namespaceSelector:
matchNames:
{{- toYaml .Values.servicemonitor.namespaceSelector | nindent 6 }}
{{- end }}
selector:
matchLabels:
{{- if .Values.servicemonitor.matchLabels }}
{{- toYaml .Values.servicemonitor.matchLabels | nindent 6 }}
{{- else }}
app: {{ template ".Chart.Name .name" $ }}
{{- end }}
{{- end }}