From bc17f3cc7bf929ec59f6579ae44133fa9cc94db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrik=20Bostr=C3=B6m?= Date: Wed, 28 Oct 2020 13:40:20 +0100 Subject: [PATCH] [home-assistant] Added metricRelabelings for service monitor (#101) * Added metricRelabelings for service monitor * Fixes * Added end * Changed chart version to 2.6.0 Co-authored-by: Jeff Billimek --- charts/home-assistant/Chart.yaml | 2 +- charts/home-assistant/README.md | 1 + charts/home-assistant/templates/servicemonitor.yaml | 4 ++++ charts/home-assistant/values.yaml | 13 ++++++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/charts/home-assistant/Chart.yaml b/charts/home-assistant/Chart.yaml index 6342fc46..4dc021ce 100644 --- a/charts/home-assistant/Chart.yaml +++ b/charts/home-assistant/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 0.116.1 description: Home Assistant name: home-assistant -version: 2.5.2 +version: 2.6.0 keywords: - home-assistant - hass diff --git a/charts/home-assistant/README.md b/charts/home-assistant/README.md index 963d2c14..7d2581b2 100644 --- a/charts/home-assistant/README.md +++ b/charts/home-assistant/README.md @@ -191,6 +191,7 @@ The following tables lists the configurable parameters of the Home Assistant cha | `monitoring.serviceMonitor.labels` | Set labels for the ServiceMonitor, use this to define your scrape label for Prometheus Operator | `{}` | | `monitoring.serviceMonitor.bearerTokenFile` | Set bearerTokenFile for home-assistant auth (use long lived access tokens) | `nil` | | `monitoring.serviceMonitor.bearerTokenSecret` | Set bearerTokenSecret for home-assistant auth (use long lived access tokens) | `nil` | +| `monitoring.serviceMonitor.metricRelabelings` | Add metricRelabelings [Documentation](https://coreos.com/operators/prometheus/docs/latest/api.html#relabelconfig) | `{}` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/charts/home-assistant/templates/servicemonitor.yaml b/charts/home-assistant/templates/servicemonitor.yaml index 7f8e9c0c..ed1f5d7b 100644 --- a/charts/home-assistant/templates/servicemonitor.yaml +++ b/charts/home-assistant/templates/servicemonitor.yaml @@ -27,6 +27,10 @@ spec: {{- if .Values.monitoring.serviceMonitor.bearerTokenSecret.optional }} optional: {{ .Values.monitoring.serviceMonitor.bearerTokenSecret.optional }} {{- end }} +{{- end }} +{{- if .Values.monitoring.serviceMonitor.metricRelabelings }} + metricRelabelings: +{{ toYaml .Values.monitoring.serviceMonitor.metricRelabelings | indent 4 }} {{- end }} jobLabel: {{ template "home-assistant.fullname" . }}-prometheus-exporter namespaceSelector: diff --git a/charts/home-assistant/values.yaml b/charts/home-assistant/values.yaml index 97bea448..521e68f8 100644 --- a/charts/home-assistant/values.yaml +++ b/charts/home-assistant/values.yaml @@ -224,7 +224,18 @@ monitoring: # bearerTokenFile: # Set bearerTokenSecret for home assistant auth (use long lived access tokens) # bearerTokenSecret: - + # Relabel metrics if needed example removes pod and instance labels from metrics beginning with hass + # metricRelabelings: [] + # - regex: hass.* + # replacement: "" + # sourceLabels: + # - __name__ + # targetLabel: pod + # - regex: hass_.* + # replacement: "" + # sourceLabels: + # - __name__ + # targetLabel: instance vscode: enabled: false