Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PodMonitor pods selection #6840

Closed
wants to merge 1 commit into from

Conversation

zhifanggao
Copy link
Contributor

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

@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (dc3ac89) to head (092f13f).
Report is 3 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master   #6840   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         687     687           
  Lines       42463   42463           
  Branches     5796    5796           
======================================
  Misses      42463   42463           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pan3793 pan3793 requested a review from dnskr December 6, 2024 09:27
Copy link
Member

@pan3793 pan3793 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense to me

@pan3793 pan3793 changed the title change the podmonitor to select pods correctly Fix PodMonitor pods selection Dec 9, 2024
@pan3793 pan3793 added this to the v1.9.4 milestone Dec 9, 2024
@pan3793 pan3793 closed this in 99e27d4 Dec 9, 2024
pan3793 pushed a commit that referenced this pull request Dec 9, 2024
### 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

092f13f [zhifanggao] change the podmonitor to select pods correctly

Authored-by: zhifanggao <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit 99e27d4)
Signed-off-by: Cheng Pan <[email protected]>
@pan3793 pan3793 modified the milestones: v1.9.4, v1.10.1 Dec 9, 2024
@pan3793
Copy link
Member

pan3793 commented Dec 9, 2024

Thanks, merged to master/1.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants