ovn-org / ovn-kubernetes

A robust Kubernetes networking platform
https://ovn-kubernetes.io/
Apache License 2.0
768 stars 334 forks source link

Add labels for ServiceMonitor K8S objects #4411

Closed csahithi closed 4 weeks ago

csahithi commented 1 month ago

What this PR does and why is it needed

This PR adds custom labels on ovn-kubernetes service monitor objects in the helm chart so that the service monitors are discovered from which the prometheus exporters scrape metrics off of.

Which issue(s) this PR fixes

None

Special notes for reviewers

None

How to verify it

Details to documentation updates

Description for the changelog

Adds labels to service monitor ovn-kubernetes objects off of which prometheus metrics are scraped.

Does this PR introduce a user-facing change?

coveralls commented 1 month ago

Coverage Status

coverage: 52.605% (+0.09%) from 52.518% when pulling 226ffc621b70e04c758685e35b52a79216a31181 on csahithi:service-monitor-label into ef892e12c00ea6b973feb2c53b0b60d238d1a389 on ovn-org:master.

csahithi commented 1 month ago

@girishmg Pls review this PR

girishmg commented 1 month ago

Some background:

  1. When someone installs prometheus through prometheus operator, they can decide how to discover various serviceMonitors in the K8s clusters.
  2. The option is set in prometheus CR object

In this example, all ServiceMonitors in all Namespaces are selected

# kubectl get prometheus -n monitoring -o yaml |grep -i servicemonitor
    serviceMonitorNamespaceSelector: {}
    serviceMonitorSelector: {}
# 

In this example, only those servicemontiors with the label release: kube-prometheus-stack will be selected

         serviceMonitorNamespaceSelector: {}
         serviceMonitorSelector:
             matchLabels:
                   release: kube-prometheus-stack
girishmg commented 4 weeks ago

Changes were only made to Helm Charts, and the helm lane test ran successfully.. so going to merge this.