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

Adds authorization for sidecar-promclient #4612

Merged
merged 15 commits into from
Nov 9, 2021

Conversation

someshkoli
Copy link
Contributor

@someshkoli someshkoli commented Aug 30, 2021

awd

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Re: #4104
Added new flag prometheus.http-client to sidecar to pass http client config via file or string(similar to alertmanager). Using this flag an instance of thanoshttp.Client is created and is passed to promclient.NewClient method which uses this client as base client instead of whole new client which then makes authorized api calls.
The same client is passed to reloader config which then makes authorized api calls to prom api.

There are some code duplication which has been duplicated from prometheus which can be easily removed by exposing one of the functions in prometheus http_config
raised_hands
Close: #3975

Verification

Added a e2e test:
Checks if query is able to query when prom uses auth

Signed-off-by: someshkoli <[email protected]>
Signed-off-by: someshkoli <[email protected]>
Signed-off-by: someshkoli <[email protected]>
pkg/extkingpin/flags.go Outdated Show resolved Hide resolved
pkg/reloader/reloader.go Outdated Show resolved Hide resolved
test/e2e/query_test.go Outdated Show resolved Hide resolved
test/e2e/e2ethanos/services.go Outdated Show resolved Hide resolved
@yeya24
Copy link
Contributor

yeya24 commented Oct 3, 2021

Let me know if you need any help @someshkoli. Would be great to have this feature merged next release.

@someshkoli
Copy link
Contributor Author

Let me know if you need any help @someshkoli. Would be great to have this feature merged next release.

will update this soon

@yeya24
Copy link
Contributor

yeya24 commented Nov 7, 2021

Hi @someshkoli, please let me know whether you are willing to continue this pr or not. It would be good to have this feature in.

@someshkoli someshkoli force-pushed the feature/promclient-authorization branch 2 times, most recently from 8e5f70f to d2f80dc Compare November 7, 2021 12:24
@someshkoli
Copy link
Contributor Author

@yeya24 had been a bit occupied last month, updated the PR with all the review comments, having a bit trouble rebasing it 🤔 , also any idea why ci is not running for e2e ?

@yeya24
Copy link
Contributor

yeya24 commented Nov 7, 2021

@yeya24 had been a bit occupied last month, updated the PR with all the review comments, having a bit trouble rebasing it 🤔 , also any idea why ci is not running for e2e ?

I guess it is because of the conflicts you have. If you don't mind I can help you rebase it. WDYT?

@someshkoli
Copy link
Contributor Author

someshkoli commented Nov 7, 2021

@yeya24 had been a bit occupied last month, updated the PR with all the review comments, having a bit trouble rebasing it thinking , also any idea why ci is not running for e2e ?

I guess it is because of the conflicts you have. If you don't mind I can help you rebase it. WDYT?

yeah that would be great
Also, has the ci check for conflict always been there or it was added recently ?

@yeya24
Copy link
Contributor

yeya24 commented Nov 8, 2021

Changelog added and the E2E test should be fixed as well. This is ready for review now

@someshkoli
Copy link
Contributor Author

someshkoli commented Nov 8, 2021

Changelog added and the E2E test should be fixed as well. This is ready for review now

Great, waiting for all greens. I guess almost all the review comments were fixed in previous PR and this one, @yeya24 one final review ?

@yeya24
Copy link
Contributor

yeya24 commented Nov 8, 2021

Changelog added and the E2E test should be fixed as well. This is ready for review now

Great, waiting for all greens. I guess almost all the review comments were fixed in previous PR and this one, @yeya24 one final review ?

I added the new commits so it is already LGTM from me. Maybe let's hear from @GiedriusS @bwplotka?

Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

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

Let's ship it first and iterate later if there is anything to improve.

pc.httpClient = extflag.RegisterPathOrContent(
cmd,
"prometheus.http-client",
"YAML file or string with http client configs. see Format details : ...",
Copy link
Contributor

Choose a reason for hiding this comment

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

@someshkoli One small nit. I think we can remove see Format details....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, its redundant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should I make another PR for this ? 😂😂😂

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to include it in a pr for auth documentation. Would you like to take it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'll make one 🙌

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be great if we can have document for this feature.

@yeya24 yeya24 merged commit c98324b into thanos-io:main Nov 9, 2021
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.

sidecar support https and basic auth access to Prometheus
2 participants