From 6ae2086f2863697761f99483bfbe70514d376083 Mon Sep 17 00:00:00 2001 From: Hai Nguyen Date: Mon, 29 Jan 2024 13:49:08 +0800 Subject: [PATCH] [KYUUBI #6006][HELM] Support additional labels for service monitor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This pull request fixes #6006 ## Describe Your Solution ๐Ÿ”ง Add new value `additionalLabels` in `serviceMonitor` to support templating the labels so that Prometheus can discover it ## Types of changes :bookmark: - [ ] Bugfix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: Our Prometheus is based on `kube-prometheus-stack` chart, so it requires label `release: kube-prometheus-stack` The current setup of kyuubi helm does not allow the ServiceMonitor can be discovered by Prome because it's not able to pass extra labels to it. #### Behavior With This Pull Request :tada: The MR enables templating extra labels #### Related Unit Tests --- # Checklist ๐Ÿ“ - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #6019 from sudohainguyen/helmchart. Closes #6006 69a86c520 [Hai Nguyen] chore: simplify labels values ed3fb0e44 [Hai Nguyen] [KYUUBI #6006] Support additional labels for service monitor Authored-by: Hai Nguyen Signed-off-by: Cheng Pan --- charts/kyuubi/templates/kyuubi-servicemonitor.yaml | 3 +++ charts/kyuubi/values.yaml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/charts/kyuubi/templates/kyuubi-servicemonitor.yaml b/charts/kyuubi/templates/kyuubi-servicemonitor.yaml index 11098a0eac2..937704bcc07 100644 --- a/charts/kyuubi/templates/kyuubi-servicemonitor.yaml +++ b/charts/kyuubi/templates/kyuubi-servicemonitor.yaml @@ -22,6 +22,9 @@ metadata: name: {{ .Release.Name }} labels: {{- include "kyuubi.labels" . | nindent 4 }} + {{- if .Values.serviceMonitor.labels }} + {{- toYaml .Values.serviceMonitor.labels | nindent 4 }} + {{- end }} spec: selector: matchLabels: diff --git a/charts/kyuubi/values.yaml b/charts/kyuubi/values.yaml index 31d802fd4f4..b6b69621ec8 100644 --- a/charts/kyuubi/values.yaml +++ b/charts/kyuubi/values.yaml @@ -297,6 +297,8 @@ serviceMonitor: # The endpoints section in a ServiceMonitor specifies the metrics information for each target endpoint. # This allows you to collect metrics from multiple Services across your Kubernetes cluster in a standardized and automated way. endpoints: [] + # Additional labels that can be used so ServiceMonitor will be discovered by Prometheus + labels: {} # Rules for the Prometheus Operator prometheusRule: