This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.10
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.10 by this push:
     new b2bda5b5cb [KYUUBI #6840] Fix PodMonitor pods selection
b2bda5b5cb is described below

commit b2bda5b5cb84a3f99ad16805956ee50fd377917d
Author: zhifanggao <[email protected]>
AuthorDate: Mon Dec 9 21:49:05 2024 +0800

    [KYUUBI #6840] Fix PodMonitor pods selection
    
    ### Why are the changes needed?
    
    I am using the podminitor of kyuubi metrics, But I found using the 
podmonitor's selector.matchLabels can not select correct pods . So I fix it .
    
    I also changed the values.yaml to add an example of podmonitor to improve 
the usability.
    
    ### How was this patch tested?
    
    ```
    helm install kyuubi .
    # kubectl get podmonitor kyuubi -oyaml
    apiVersion: monitoring.coreos.com/v1
    kind: PodMonitor
    metadata:
      annotations:
        meta.helm.sh/release-name: kyuubi
        meta.helm.sh/release-namespace: default
      creationTimestamp: "2024-12-06T07:46:12Z"
      generation: 1
      labels:
        app.kubernetes.io/instance: kyuubi
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/name: kyuubi
        app.kubernetes.io/version: 1.8.0
        helm.sh/chart: kyuubi-0.1.0
      name: kyuubi
      namespace: default
      resourceVersion: "7583800"
      uid: 0dd11e43-d126-434e-988a-7f1914586e2b
    spec:
      podMetricsEndpoints:
      - path: /metrics
        port: prometheus
      selector:
        matchLabels:
          app.kubernetes.io/instance: kyuubi
          app.kubernetes.io/name: kyuubi
    # kubectl get po -l app.kubernetes.io/instance=kyuubi
    NAME       READY   STATUS    RESTARTS   AGE
    kyuubi-0   1/1     Running   0          24m
    kyuubi-1   1/1     Running   0          22m
    # kubectl get po -l  app.kubernetes.io/name=kyuubi
    NAME       READY   STATUS    RESTARTS   AGE
    kyuubi-0   1/1     Running   0          24m
    kyuubi-1   1/1     Running   0          23m
    ```
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No
    
    Closes #6840 from zhifanggao/change_podmonitor.
    
    Closes #6840
    
    092f13f87 [zhifanggao] change the podmonitor to select pods correctly
    
    Authored-by: zhifanggao <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 99e27d4f99fbec61fbb4ef686ddb6f4d88182a6f)
    Signed-off-by: Cheng Pan <[email protected]>
---
 charts/kyuubi/templates/kyuubi-podmonitor.yaml | 2 +-
 charts/kyuubi/values.yaml                      | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/charts/kyuubi/templates/kyuubi-podmonitor.yaml 
b/charts/kyuubi/templates/kyuubi-podmonitor.yaml
index b10d80c3ff..125ecac6f6 100644
--- a/charts/kyuubi/templates/kyuubi-podmonitor.yaml
+++ b/charts/kyuubi/templates/kyuubi-podmonitor.yaml
@@ -25,7 +25,7 @@ metadata:
 spec:
   selector:
     matchLabels:
-      app: {{ .Release.Name }}
+      {{- include "kyuubi.selectorLabels" . | nindent 6 }}
   podMetricsEndpoints:
     {{- toYaml .Values.metrics.podMonitor.podMetricsEndpoints | nindent 4 }}
 {{- end }}
diff --git a/charts/kyuubi/values.yaml b/charts/kyuubi/values.yaml
index 23e5e7fdc4..1bd4b5f794 100644
--- a/charts/kyuubi/values.yaml
+++ b/charts/kyuubi/values.yaml
@@ -288,6 +288,9 @@ metrics:
     enabled: false
     # List of pod endpoints serving metrics to be scraped by Prometheus, see 
Prometheus Operator docs for more details
     podMetricsEndpoints: []
+    #  podMetricsEndpoints:
+    #    - path: /metrics
+    #      port: prometheus
 
   # ServiceMonitor by Prometheus Operator
   serviceMonitor:

Reply via email to