cloud-bulldozer / go-commons

Code repository with all go common packages and libraries
Apache License 2.0
4 stars 9 forks source link

Use Prometheus bearer token only when provided #39

Closed diversario closed 7 months ago

diversario commented 7 months ago

Type of change

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

Checklist before requesting a review

Testing

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

codecov[bot] commented 7 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

Additional details and impacted files ```diff @@ 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 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

diversario commented 7 months ago

Wow, this was super fast 🤯

Will this land in kube-burner soon as well?

rsevilla87 commented 7 months ago

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 commented 7 months ago

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