Skip to content

Commit

Permalink
[KYUUBI apache#6006][HELM] Support additional labels for service monitor
Browse files Browse the repository at this point in the history
# 🔍 Description
## Issue References 🔗

This pull request fixes apache#6006

## Describe Your Solution 🔧

Add new value `additionalLabels` in `serviceMonitor` to support templating the labels so that Prometheus can discover it

## Types of changes 🔖

- [ ] 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 ⚰️
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 🎉
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 apache#6019 from sudohainguyen/helmchart.

Closes apache#6006

69a86c5 [Hai Nguyen] chore: simplify labels values
ed3fb0e [Hai Nguyen] [KYUUBI apache#6006] Support additional labels for service monitor

Authored-by: Hai Nguyen <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
  • Loading branch information
sudohainguyen authored and zhaohehuhu committed Feb 5, 2024
1 parent b0d029d commit c35649d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/kyuubi/templates/kyuubi-servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions charts/kyuubi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c35649d

Please sign in to comment.