Skip to content

Commit d93aac5

Browse files
Merge pull request #170 from jkroepke/service-monitor
helm: Enrich serviceMonitor properties
2 parents 71a13af + 0558cfb commit d93aac5

File tree

5 files changed

+82
-5
lines changed

5 files changed

+82
-5
lines changed

helm/oauth2-proxy/Chart.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: oauth2-proxy
2-
version: 6.18.3
2+
version: 6.19.0
33
apiVersion: v2
44
appVersion: 7.5.1
55
home: https://oauth2-proxy.github.io/oauth2-proxy/
@@ -35,7 +35,7 @@ kubeVersion: ">=1.9.0-0"
3535
annotations:
3636
artifacthub.io/changes: |
3737
- kind: added
38-
description: Updated Redis and Prometheus Operator to the latest version.
38+
description: Make serviceMonitor.scheme,serviceMonitor.bearerTokenFile,serviceMonitor.tlsConfig,serviceMonitor.targetLabels configurable
3939
links:
4040
- name: Github PR
41-
url: https://github.com/oauth2-proxy/manifests/pull/172
41+
url: https://github.com/oauth2-proxy/manifests/pull/170

helm/oauth2-proxy/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,12 @@ Parameter | Description | Default
207207
`metrics.serviceMonitor.interval` | Prometheus scrape interval | `60s`
208208
`metrics.serviceMonitor.scrapeTimeout` | Prometheus scrape timeout | `30s`
209209
`metrics.serviceMonitor.labels` | Add custom labels to the ServiceMonitor resource| `{}`
210+
`metrics.serviceMonitor.scheme` | HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS.| `""`
211+
`metrics.serviceMonitor.tlsConfig` | TLS configuration to use when scraping the endpoint. For example if using istio mTLS.| `{}`
212+
`metrics.serviceMonitor.bearerTokenFile` | Path to bearer token file.| `""`
213+
`metrics.serviceMonitor.annotations` | Used to pass annotations that are used by the Prometheus installed in your cluster| `{}`
214+
`metrics.serviceMonitor.metricRelabelings` | Metric relabel configs to apply to samples before ingestion.| `[]`
215+
`metrics.serviceMonitor.relabelings` | Relabel configs to apply to samples before ingestion.| `[]`
210216
`extraObjects` | Extra K8s manifests to deploy | `[]`
211217

212218
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

helm/oauth2-proxy/ci/servicemonitor-values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,17 @@ metrics:
22
enabled: true
33
serviceMonitor:
44
enabled: true
5+
annotations:
6+
key: value
7+
metricRelabelings:
8+
- action: keep
9+
regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
10+
sourceLabels: [__name__]
11+
12+
relabelings:
13+
- sourceLabels: [__meta_kubernetes_pod_node_name]
14+
separator: ;
15+
regex: ^(.*)$
16+
targetLabel: nodename
17+
replacement: $1
18+
action: replace

helm/oauth2-proxy/templates/servicemonitor.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
apiVersion: monitoring.coreos.com/v1
33
kind: ServiceMonitor
44
metadata:
5+
{{- with .Values.metrics.serviceMonitor.annotations }}
6+
annotations:
7+
{{- toYaml . | nindent 4 }}
8+
{{- end }}
59
name: {{ template "oauth2-proxy.fullname" . }}
610
{{- if .Values.metrics.serviceMonitor.namespace }}
711
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
@@ -26,6 +30,28 @@ spec:
2630
endpoints:
2731
- port: metrics
2832
path: "/metrics"
29-
interval: {{ .Values.metrics.serviceMonitor.interval }}
30-
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
33+
{{- with .Values.metrics.serviceMonitor.interval }}
34+
interval: {{ . }}
35+
{{- end }}
36+
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
37+
scrapeTimeout: {{ . }}
38+
{{- end }}
39+
{{- with .Values.metrics.serviceMonitor.scheme }}
40+
scheme: {{ . }}
41+
{{- end }}
42+
{{- with .Values.metrics.serviceMonitor.bearerTokenFile }}
43+
bearerTokenFile: {{ . }}
44+
{{- end }}
45+
{{- with .Values.metrics.serviceMonitor.tlsConfig }}
46+
tlsConfig:
47+
{{- toYaml .| nindent 4 }}
48+
{{- end }}
49+
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
50+
metricRelabelings:
51+
{{- toYaml . | nindent 4 }}
52+
{{- end }}
53+
{{- with .Values.metrics.serviceMonitor.relabelings }}
54+
relabelings:
55+
{{- toYaml . | nindent 4 }}
56+
{{- end }}
3157
{{- end }}

helm/oauth2-proxy/values.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,37 @@ metrics:
373373
# Add custom labels to the ServiceMonitor resource
374374
labels: {}
375375

376+
## scheme: HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS.
377+
scheme: ""
378+
379+
## tlsConfig: TLS configuration to use when scraping the endpoint. For example if using istio mTLS.
380+
## Of type: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#tlsconfig
381+
tlsConfig: {}
382+
383+
## bearerTokenFile: Path to bearer token file.
384+
bearerTokenFile: ""
385+
386+
## Used to pass annotations that are used by the Prometheus installed in your cluster to select Service Monitors to work with
387+
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec
388+
annotations: {}
389+
390+
## Metric relabel configs to apply to samples before ingestion.
391+
## [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs)
392+
metricRelabelings: []
393+
# - action: keep
394+
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
395+
# sourceLabels: [__name__]
396+
397+
## Relabel configs to apply to samples before ingestion.
398+
## [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config)
399+
relabelings: []
400+
# - sourceLabels: [__meta_kubernetes_pod_node_name]
401+
# separator: ;
402+
# regex: ^(.*)$
403+
# targetLabel: nodename
404+
# replacement: $1
405+
# action: replace
406+
376407
# Extra K8s manifests to deploy
377408
extraObjects: []
378409
# - apiVersion: secrets-store.csi.x-k8s.io/v1

0 commit comments

Comments
 (0)