Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helm: Enrich serviceMonitor properties #170

Merged
merged 10 commits into from
Nov 13, 2023
6 changes: 3 additions & 3 deletions helm/oauth2-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: oauth2-proxy
version: 6.18.3
version: 6.19.0
apiVersion: v2
appVersion: 7.5.1
home: https://oauth2-proxy.github.io/oauth2-proxy/
Expand Down Expand Up @@ -35,7 +35,7 @@ kubeVersion: ">=1.9.0-0"
annotations:
artifacthub.io/changes: |
- kind: added
description: Updated Redis and Prometheus Operator to the latest version.
description: Make serviceMonitor.scheme,serviceMonitor.bearerTokenFile,serviceMonitor.tlsConfig,serviceMonitor.targetLabels configurable
links:
- name: Github PR
url: https://github.com/oauth2-proxy/manifests/pull/172
url: https://github.com/oauth2-proxy/manifests/pull/170
6 changes: 6 additions & 0 deletions helm/oauth2-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ Parameter | Description | Default
`metrics.serviceMonitor.interval` | Prometheus scrape interval | `60s`
`metrics.serviceMonitor.scrapeTimeout` | Prometheus scrape timeout | `30s`
`metrics.serviceMonitor.labels` | Add custom labels to the ServiceMonitor resource| `{}`
`metrics.serviceMonitor.scheme` | HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS.| `""`
`metrics.serviceMonitor.tlsConfig` | TLS configuration to use when scraping the endpoint. For example if using istio mTLS.| `{}`
`metrics.serviceMonitor.bearerTokenFile` | Path to bearer token file.| `""`
`metrics.serviceMonitor.annotations` | Used to pass annotations that are used by the Prometheus installed in your cluster| `{}`
`metrics.serviceMonitor.metricRelabelings` | Metric relabel configs to apply to samples before ingestion.| `[]`
`metrics.serviceMonitor.relabelings` | Relabel configs to apply to samples before ingestion.| `[]`
`extraObjects` | Extra K8s manifests to deploy | `[]`

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
Expand Down
14 changes: 14 additions & 0 deletions helm/oauth2-proxy/ci/servicemonitor-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@ metrics:
enabled: true
serviceMonitor:
enabled: true
annotations:
key: value
metricRelabelings:
- action: keep
regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
sourceLabels: [__name__]

relabelings:
- sourceLabels: [__meta_kubernetes_pod_node_name]
separator: ;
regex: ^(.*)$
targetLabel: nodename
replacement: $1
action: replace
30 changes: 28 additions & 2 deletions helm/oauth2-proxy/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
{{- with .Values.metrics.serviceMonitor.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ template "oauth2-proxy.fullname" . }}
{{- if .Values.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.metrics.serviceMonitor.namespace }}
Expand All @@ -26,6 +30,28 @@ spec:
endpoints:
- port: metrics
path: "/metrics"
interval: {{ .Values.metrics.serviceMonitor.interval }}
scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
{{- with .Values.metrics.serviceMonitor.interval }}
interval: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scrapeTimeout }}
scrapeTimeout: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.scheme }}
scheme: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ . }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.tlsConfig }}
tlsConfig:
{{- toYaml .| nindent 4 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.metricRelabelings }}
metricRelabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.metrics.serviceMonitor.relabelings }}
relabelings:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
31 changes: 31 additions & 0 deletions helm/oauth2-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,37 @@ metrics:
# Add custom labels to the ServiceMonitor resource
labels: {}

## scheme: HTTP scheme to use for scraping. Can be used with `tlsConfig` for example if using istio mTLS.
scheme: ""

## tlsConfig: TLS configuration to use when scraping the endpoint. For example if using istio mTLS.
## Of type: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#tlsconfig
tlsConfig: {}

## bearerTokenFile: Path to bearer token file.
bearerTokenFile: ""

## Used to pass annotations that are used by the Prometheus installed in your cluster to select Service Monitors to work with
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec
annotations: {}

## Metric relabel configs to apply to samples before ingestion.
## [Metric Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs)
metricRelabelings: []
# - action: keep
# regex: 'kube_(daemonset|deployment|pod|namespace|node|statefulset).+'
# sourceLabels: [__name__]

## Relabel configs to apply to samples before ingestion.
## [Relabeling](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config)
relabelings: []
# - sourceLabels: [__meta_kubernetes_pod_node_name]
# separator: ;
# regex: ^(.*)$
# targetLabel: nodename
# replacement: $1
# action: replace

# Extra K8s manifests to deploy
extraObjects: []
# - apiVersion: secrets-store.csi.x-k8s.io/v1
Expand Down
Loading