[KYUUBI #7105] [K8S][HELM] Support additional labels for PrometheusRule

### Why are the changes needed?
The change is needed to be able to add additional labels to `PrometheusRule` similar to [podMonitor](523722788f/charts/kyuubi/values.yaml (L321-L330)) and [serviceMonitor](523722788f/charts/kyuubi/values.yaml (L333-L341)).
The PR also includes minor identation fixes.

### How was this patch tested?
```shell
helm template kyuubi charts/kyuubi --set metrics.prometheusRule.enabled=true --set metrics.prometheusRule.labels.test-label=true -s templates/kyuubi-alert.yaml
---
# Source: kyuubi/templates/kyuubi-alert.yaml
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: kyuubi
  labels:
    helm.sh/chart: kyuubi-0.1.0
    app.kubernetes.io/name: kyuubi
    app.kubernetes.io/instance: kyuubi
    app.kubernetes.io/version: "1.10.0"
    app.kubernetes.io/managed-by: Helm
    test-label: true
spec:
  groups:
    []
```

### Was this patch authored or co-authored using generative AI tooling?
No

Closes #7105 from dnskr/helm-prometheusRule-labels.

Closes #7105

234d99da3 [dnskr] [K8S][HELM] Support additional labels for PrometheusRule

Authored-by: dnskr <dnskrv88@gmail.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
dnskr 2025-06-23 23:48:15 +08:00 committed by Cheng Pan
parent bdeb29451c
commit 2021574a33
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D
5 changed files with 8 additions and 3 deletions

View File

@ -22,6 +22,9 @@ metadata:
name: {{ .Release.Name }}
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
{{- if .Values.metrics.prometheusRule.labels }}
{{- toYaml .Values.metrics.prometheusRule.labels | nindent 4 }}
{{- end }}
spec:
groups:
{{- toYaml .Values.metrics.prometheusRule.groups | nindent 4 }}

View File

@ -23,7 +23,7 @@ metadata:
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
{{- if .Values.metrics.podMonitor.labels }}
{{- toYaml .Values.metrics.podMonitor.labels | nindent 4 }}
{{- toYaml .Values.metrics.podMonitor.labels | nindent 4 }}
{{- end }}
spec:
selector:

View File

@ -23,7 +23,7 @@ metadata:
labels:
{{- include "kyuubi.labels" . | nindent 4 }}
{{- if .Values.metrics.serviceMonitor.labels }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- toYaml .Values.metrics.serviceMonitor.labels | nindent 4 }}
{{- end }}
spec:
selector:

View File

@ -41,7 +41,7 @@ spec:
checksum/conf: {{ include (print $.Template.BasePath "/kyuubi-configmap.yaml") . | sha256sum }}
checksum/conf-hadoop: {{ include (print $.Template.BasePath "/kyuubi-hadoop-configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}

View File

@ -346,3 +346,5 @@ metrics:
enabled: false
# Content of Prometheus rule file
groups: []
# Additional labels to be used to make PrometheusRule discovered by Prometheus
labels: {}