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

Use Prometheus bearer token only when provided #39

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

diversario
Copy link
Contributor

Type of change

  • Refactor
  • New feature
  • Bug fix
  • Optimization
  • Documentation Update

Description

This library is used in kube-burner. kube-burner's init command accepts username, password and token parameters for connecting to Prometheus. However, it is not possible to connect to Prometheus that is configured with username/password only because this library unconditionally sets the Bearer header, including with an empty token. This results in a 401 from the Prometheus client.

Related Tickets & Documents

  • Related Issue #
  • Closes #

Checklist before requesting a review

  • I have performed a self-review of my code.
  • If it is a core feature, I have added thorough tests.

Testing

I tested this by building kube-burner with the proposed changes and seeing it successfully connect to my basic auth Prometheus.

@jtaleric jtaleric self-requested a review November 30, 2023 13:03
Copy link

codecov bot commented Nov 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d38a199) 83.33% compared to head (ea011fc) 83.43%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #39      +/-   ##
==========================================
+ Coverage   83.33%   83.43%   +0.10%     
==========================================
  Files           6        6              
  Lines         312      314       +2     
==========================================
+ Hits          260      262       +2     
  Misses         38       38              
  Partials       14       14              

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

Copy link
Member

@jtaleric jtaleric left a comment

Choose a reason for hiding this comment

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

Thanks for catching this! lgtm

@vishnuchalla vishnuchalla merged commit 1b0a1cc into cloud-bulldozer:main Nov 30, 2023
6 checks passed
@diversario diversario deleted the fix-prom-client-auth branch November 30, 2023 13:11
@diversario
Copy link
Contributor Author

Wow, this was super fast 🤯

Will this land in kube-burner soon as well?

@rsevilla87
Copy link
Member

Wow, this was super fast 🤯

Will this land in kube-burner soon as well?

Yeah, I'll cut a hotfix release with this patch today, I'll ping you when ready

@rsevilla87
Copy link
Member

rsevilla87 commented Dec 4, 2023

Hey @diversario , checkout kube-burner v1.8.0
https://github.com/cloud-bulldozer/kube-burner/releases/tag/v1.8.0

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