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

[prometheus-pushgateway] Add 'release' label to prometheus-pushgateway service monitor #4369

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nbelov-magdv
Copy link

@nbelov-magdv nbelov-magdv commented Mar 20, 2024

'release' label is required for integrating with kube-prometheus-stack

What this PR does / why we need it

Adds 'release' label to prometheus-pushgateway ServiceMonitor.
This label is used by prometheus from kube-prometheus-stack for collecting metrics.

I cannot use {{ .Release.Name }} as value in values.yaml. So I've add it to template.

Also, I don't understand why kube-prometheus-stack uses 'release' label, but not 'app.kubernetes.io/instance' label.
But I am not good in k8s.

Which issue this PR fixes

(optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged)

  • fixes #

Special notes for your reviewer

Checklist

  • DCO signed
  • Chart Version bumped
  • Title of the PR starts with chart name (e.g. [prometheus-couchdb-exporter])

'release' label is required for integrating with kube-prometheus-stack

Signed-off-by: nbelov-magdv <[email protected]>
Signed-off-by: nbelov-magdv <[email protected]>
@nbelov-magdv nbelov-magdv changed the title Add 'release' label to prometheus-pushgateway service monitor [prometheus-pushgateway] Add 'release' label to prometheus-pushgateway service monitor Mar 20, 2024
Copy link
Contributor

@zeritti zeritti left a comment

Choose a reason for hiding this comment

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

Thank you, @nbelov-magdv, for your PR.

'release' label is required for integrating with kube-prometheus-stack

It is not entirely true. By default, Prometheus operator as deployed through kube-prometheus-stack sets a service monitor selector to release: RELEASE_NAME. Keeping it is not required, though, as this service monitor selector can be cleared by means of prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues=false and, optionally, a custom selector can be set through prometheus.prometheusSpec.serviceMonitorSelector (serviceMonitorSelector).

If such a selector is set in prometheus CR, either default or custom, the corresponding label can be set in pushgateway chart's serviceMonitor.additionalLabels. Adding the release label to all manifests' labels and selectors by default seems unnecessary. We could, however, consider optionally inserting the release label in labels through a boolean field e.g. releaseLabel.

@nbelov-magdv nbelov-magdv requested a review from zeritti March 25, 2024 06:36
@nbelov-magdv
Copy link
Author

Thank you for good idea.
I've refactored patch: add 'serviceMonitor.releaseLabel' boolean parameter for adding 'release' label.

Copy link

stale bot commented Feb 1, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@stale stale bot added the lifecycle/stale label Feb 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants