From c58d967c21074c4feb5527ad74b7a17b55f8ed97 Mon Sep 17 00:00:00 2001 From: ryan-dyer-sp Date: Mon, 19 Oct 2020 16:10:49 -0500 Subject: [PATCH] Support multiple instances and extra labels for service monitor (#171) --- charts/kafka-lag-exporter/templates/060-ServiceMonitor.yaml | 4 ++++ charts/kafka-lag-exporter/values.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/charts/kafka-lag-exporter/templates/060-ServiceMonitor.yaml b/charts/kafka-lag-exporter/templates/060-ServiceMonitor.yaml index c57577d0..3221c03c 100644 --- a/charts/kafka-lag-exporter/templates/060-ServiceMonitor.yaml +++ b/charts/kafka-lag-exporter/templates/060-ServiceMonitor.yaml @@ -19,6 +19,7 @@ spec: selector: matchLabels: app.kubernetes.io/name: {{ include "kafka-lag-exporter.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} helm.sh/chart: {{ include "kafka-lag-exporter.chart" . }} namespaceSelector: matchNames: @@ -29,4 +30,7 @@ spec: {{- if .Values.prometheus.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ .Values.prometheus.serviceMonitor.scrapeTimeout }} {{- end }} + {{- if .Values.prometheus.serviceMonitor.additionalConfig }} +{{ toYaml .Values.prometheus.serviceMonitor.additionalConfig | indent 2}} + {{- end }} {{- end }} diff --git a/charts/kafka-lag-exporter/values.yaml b/charts/kafka-lag-exporter/values.yaml index 68603683..88acf313 100644 --- a/charts/kafka-lag-exporter/values.yaml +++ b/charts/kafka-lag-exporter/values.yaml @@ -138,4 +138,8 @@ prometheus: # service monitor label selectors: https://github.com/helm/charts/blob/f5a751f174263971fafd21eee4e35416d6612a3d/stable/prometheus-operator/templates/prometheus/prometheus.yaml#L74 # additionalLabels: # prometheus: k8s + # additionalConfig: + # targetLabels: + # - prometheus + # - app.kubernetes.io/name