Skip to content

Commit aab82e7

Browse files
committed
feat: add servicemonitor options
Signed-off-by: Dov Devers <renaud-dov.devers@diabolocom.com>
1 parent 1993bd9 commit aab82e7

5 files changed

Lines changed: 71 additions & 2 deletions

File tree

charts/coredns/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: coredns
3-
version: 1.45.2
3+
version: 1.46.0
44
appVersion: 1.13.1
55
home: https://coredns.io
66
icon: https://coredns.io/images/CoreDNS_Colour_Horizontal.png
@@ -20,4 +20,4 @@ type: application
2020
annotations:
2121
artifacthub.io/changes: |
2222
- kind: added
23-
description: Add configurable dnsPolicy for deployment
23+
description: Add scrapeTimeout, scheme, honorLabels, tlsConfig, relabelings, and metricRelabelings options to ServiceMonitor endpoint

charts/coredns/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ The command removes all the Kubernetes components associated with the chart and
126126
| `prometheus.monitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | {} |
127127
| `prometheus.monitor.namespace` | Selector to select which namespaces the Endpoints objects are discovered from. | `""` |
128128
| `prometheus.monitor.interval` | Scrape interval for polling the metrics endpoint. (E.g. "30s") | `""` |
129+
| `prometheus.monitor.scrapeTimeout` | Timeout for each scrape request. (E.g. "10s") | `""` |
130+
| `prometheus.monitor.scheme` | HTTP scheme used for scraping. (`http` or `https`) | `""` |
131+
| `prometheus.monitor.honorLabels` | Honor labels from the target when scraping | `false` |
132+
| `prometheus.monitor.tlsConfig` | TLS configuration for the metrics endpoint (e.g. `insecureSkipVerify`, certificates) | `{}` |
133+
| `prometheus.monitor.relabelings` | List of target relabeling rules applied before scraping | `[]` |
134+
| `prometheus.monitor.metricRelabelings` | List of metric relabeling rules applied after scraping | `[]` |
129135
| `prometheus.monitor.selector` | Service selector | `{}` |
130136
| `service.clusterIP` | IP address to assign to service | `""` |
131137
| `service.clusterIPs` | IP addresses to assign to service | `[]` |

charts/coredns/templates/servicemonitor.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,25 @@ spec:
3737
{{- if .Values.prometheus.monitor.interval }}
3838
interval: {{ .Values.prometheus.monitor.interval }}
3939
{{- end }}
40+
{{- if .Values.prometheus.monitor.scrapeTimeout }}
41+
scrapeTimeout: {{ .Values.prometheus.monitor.scrapeTimeout }}
42+
{{- end }}
43+
{{- if .Values.prometheus.monitor.scheme }}
44+
scheme: {{ .Values.prometheus.monitor.scheme }}
45+
{{- end }}
46+
{{- if .Values.prometheus.monitor.honorLabels }}
47+
honorLabels: {{ .Values.prometheus.monitor.honorLabels }}
48+
{{- end }}
49+
{{- with .Values.prometheus.monitor.tlsConfig }}
50+
tlsConfig:
51+
{{- toYaml . | nindent 8 }}
52+
{{- end }}
53+
{{- with .Values.prometheus.monitor.relabelings }}
54+
relabelings:
55+
{{- toYaml . | nindent 8 }}
56+
{{- end }}
57+
{{- with .Values.prometheus.monitor.metricRelabelings }}
58+
metricRelabelings:
59+
{{- toYaml . | nindent 8 }}
60+
{{- end }}
4061
{{- end }}

charts/coredns/tests/servicemonitor_test.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ set:
1212
enabled: true
1313
namespace: monitoring
1414
interval: 15s
15+
scrapeTimeout: 10s
16+
scheme: https
17+
honorLabels: true
18+
tlsConfig:
19+
insecureSkipVerify: true
20+
relabelings:
21+
- sourceLabels: [__address__]
22+
targetLabel: instance
23+
metricRelabelings:
24+
- sourceLabels: [__name__]
25+
regex: coredns_dns_request_duration_seconds.*
26+
action: keep
1527
additionalLabels:
1628
team: infra
1729
selector:
@@ -62,3 +74,27 @@ tests:
6274
- equal:
6375
path: spec.endpoints[0].interval
6476
value: 15s
77+
78+
- equal:
79+
path: spec.endpoints[0].scrapeTimeout
80+
value: 10s
81+
82+
- equal:
83+
path: spec.endpoints[0].scheme
84+
value: https
85+
86+
- equal:
87+
path: spec.endpoints[0].honorLabels
88+
value: true
89+
90+
- equal:
91+
path: spec.endpoints[0].tlsConfig.insecureSkipVerify
92+
value: true
93+
94+
- equal:
95+
path: spec.endpoints[0].relabelings[0].targetLabel
96+
value: instance
97+
98+
- equal:
99+
path: spec.endpoints[0].metricRelabelings[0].action
100+
value: keep

charts/coredns/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ prometheus:
5050
additionalLabels: {}
5151
namespace: ""
5252
interval: ""
53+
scrapeTimeout: ""
54+
scheme: ""
55+
honorLabels: false
56+
tlsConfig: {}
57+
relabelings: []
58+
metricRelabelings: []
5359
selector: {}
5460

5561
service:

0 commit comments

Comments
 (0)