Skip to content

Conversation

@killerwhile
Copy link

@killerwhile killerwhile commented Dec 19, 2025

What this PR does / why we need it

Some ServiceMonitors send bearer token where it's not needed, especially to http endpoints.
This PR do allow to configure when to set the bearer token. It keeps the actual behavior, configuration options should actively being set to change the behavior.

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])

Copy link
Member

@GMartinez-Sisti GMartinez-Sisti left a comment

Choose a reason for hiding this comment

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

Hi @killerwhile, thanks for the contribution.

What about using sendBearerToken instead and set it true by default that still keeps it backwards compatible? I think semantically is easier to understand than a possible double negative.

@GMartinez-Sisti GMartinez-Sisti changed the title [serviceMonitors] Do not send the bearer token to every service [kube-prometheus-stack] Do not send the bearer token to every service Dec 19, 2025
@killerwhile
Copy link
Author

Thanks for your comment. This would make more sense, indeed. I'll update shortly. Thanks

@killerwhile killerwhile force-pushed the fix/remove-unnecessary-bearertoken branch from a05f904 to 076d5dd Compare January 10, 2026 09:25
@killerwhile
Copy link
Author

@GMartinez-Sisti I updated as you proposed and DCO signed the commit.
Please review and let me know. Thanks

Comment on lines +43 to +45
{{- if .Values.coreDns.serviceMonitor.sendBearerToken }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
{{- end }}
Copy link
Member

@jkroepke jkroepke Jan 10, 2026

Choose a reason for hiding this comment

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

for consistency reasons, i preffer the pattern that we used for other properties as well.

Move bearerTokenFile to values and you can empty the value on your own.

Suggested change
{{- if .Values.coreDns.serviceMonitor.sendBearerToken }}
bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
{{- end }}
{{- if .Values.coreDns.serviceMonitor.bearerTokenFile }}
bearerTokenFile: {{ .Values.coreDns.serviceMonitor.bearerTokenFile }}
{{- end }}

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the review. I'll adapt shortly.

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.

3 participants