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 3 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 <123946722+nbelov-magdv@users.noreply.github.com>
Signed-off-by: nbelov-magdv <123946722+nbelov-magdv@users.noreply.github.com>
@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
Member

@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
Copy link
Author

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

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.

None yet

2 participants