Skip to content

Commit 6677d88

Browse files
committed
add tls config, bearer token options, namespace selection, labels, and scrape limits
1 parent 2529d25 commit 6677d88

3 files changed

Lines changed: 86 additions & 2 deletions

File tree

charts/netobserv/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ For additional environment configurations, please refer to the [configuration re
5151

5252
### Prometheus Operator ServiceMonitor
5353

54-
If you use the Prometheus Operator, you can enable a `ServiceMonitor` to scrape metrics from the collector Service.
54+
If you use the Prometheus Operator, you can enable a `ServiceMonitor` to scrape metrics from the flow collector Service.
5555

56-
Example values:
56+
Quick start:
5757

5858
```yaml
5959
serviceMonitor:

charts/netobserv/templates/servicemonitor.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,48 @@ spec:
1616
matchLabels:
1717
{{- include "netobserv.selectorLabels" . | nindent 6 }}
1818
namespaceSelector:
19+
{{- if .Values.serviceMonitor.namespaceSelector.any }}
20+
any: true
21+
{{- else if .Values.serviceMonitor.namespaceSelector.matchNames }}
22+
matchNames:
23+
{{- toYaml .Values.serviceMonitor.namespaceSelector.matchNames | nindent 6 }}
24+
{{- else }}
1925
matchNames:
2026
- {{ .Release.Namespace }}
27+
{{- end }}
2128
endpoints:
2229
- port: {{ .Values.serviceMonitor.portName }}
2330
path: {{ .Values.serviceMonitor.path }}
2431
interval: {{ .Values.serviceMonitor.interval }}
2532
scrapeTimeout: {{ .Values.serviceMonitor.scrapeTimeout }}
2633
scheme: {{ .Values.serviceMonitor.scheme }}
2734
honorLabels: {{ .Values.serviceMonitor.honorLabels }}
35+
followRedirects: {{ .Values.serviceMonitor.followRedirects }}
36+
{{- with .Values.serviceMonitor.params }}
37+
params:
38+
{{- toYaml . | nindent 8 }}
39+
{{- end }}
40+
{{- if .Values.serviceMonitor.bearerTokenSecret.enabled }}
41+
bearerTokenSecret:
42+
name: {{ .Values.serviceMonitor.bearerTokenSecret.name }}
43+
key: {{ .Values.serviceMonitor.bearerTokenSecret.key }}
44+
{{- end }}
45+
{{- if .Values.serviceMonitor.tlsConfig.enabled }}
46+
tlsConfig:
47+
insecureSkipVerify: {{ .Values.serviceMonitor.tlsConfig.insecureSkipVerify }}
48+
{{- with .Values.serviceMonitor.tlsConfig.serverName }}
49+
serverName: {{ . | quote }}
50+
{{- end }}
51+
{{- with .Values.serviceMonitor.tlsConfig.caFile }}
52+
caFile: {{ . | quote }}
53+
{{- end }}
54+
{{- with .Values.serviceMonitor.tlsConfig.certFile }}
55+
certFile: {{ . | quote }}
56+
{{- end }}
57+
{{- with .Values.serviceMonitor.tlsConfig.keyFile }}
58+
keyFile: {{ . | quote }}
59+
{{- end }}
60+
{{- end }}
2861
{{- with .Values.serviceMonitor.relabelings }}
2962
relabelings:
3063
{{- toYaml . | nindent 8 }}
@@ -33,6 +66,28 @@ spec:
3366
metricRelabelings:
3467
{{- toYaml . | nindent 8 }}
3568
{{- end }}
69+
{{- with .Values.serviceMonitor.jobLabel }}
70+
jobLabel: {{ . }}
71+
{{- end }}
72+
{{- with .Values.serviceMonitor.targetLabels }}
73+
targetLabels:
74+
{{- toYaml . | nindent 2 }}
75+
{{- end }}
76+
{{- if .Values.serviceMonitor.sampleLimit }}
77+
sampleLimit: {{ .Values.serviceMonitor.sampleLimit }}
78+
{{- end }}
79+
{{- if .Values.serviceMonitor.labelLimit }}
80+
labelLimit: {{ .Values.serviceMonitor.labelLimit }}
81+
{{- end }}
82+
{{- if .Values.serviceMonitor.labelNameLengthLimit }}
83+
labelNameLengthLimit: {{ .Values.serviceMonitor.labelNameLengthLimit }}
84+
{{- end }}
85+
{{- if .Values.serviceMonitor.labelValueLengthLimit }}
86+
labelValueLengthLimit: {{ .Values.serviceMonitor.labelValueLengthLimit }}
87+
{{- end }}
88+
{{- with .Values.serviceMonitor.proxyUrl }}
89+
proxyUrl: {{ . | quote }}
90+
{{- end }}
3691
{{- end }}
3792

3893

charts/netobserv/values.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,12 @@ serviceMonitor:
298298
namespace: ""
299299
# Extra labels to add to the ServiceMonitor (e.g., release: prometheus)
300300
labels: {}
301+
# Select Services to scrape across namespaces
302+
namespaceSelector:
303+
# When true, select Services in all namespaces. If true, matchNames is ignored.
304+
any: false
305+
# Explicit list of namespaces to match. Defaults to the release namespace when empty and any=false.
306+
matchNames: []
301307
# Endpoint settings
302308
interval: 30s
303309
scrapeTimeout: 10s
@@ -309,3 +315,26 @@ serviceMonitor:
309315
# Optional relabelings
310316
relabelings: []
311317
metricRelabelings: []
318+
# Optional params to append to scrape requests (?foo=bar)
319+
params: {}
320+
# Authentication and TLS (if your endpoint requires it)
321+
bearerTokenSecret:
322+
enabled: false
323+
name: ""
324+
key: ""
325+
tlsConfig:
326+
enabled: false
327+
insecureSkipVerify: false
328+
serverName: ""
329+
caFile: ""
330+
certFile: ""
331+
keyFile: ""
332+
# Limits and labeling
333+
jobLabel: ""
334+
targetLabels: []
335+
sampleLimit: 0
336+
labelLimit: 0
337+
labelNameLengthLimit: 0
338+
labelValueLengthLimit: 0
339+
followRedirects: true
340+
proxyUrl: ""

0 commit comments

Comments
 (0)