-
Notifications
You must be signed in to change notification settings - Fork 24
Accept custom transport of custom http client #1627
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
Conversation
Signed-off-by: Jan-Otto Kröpke <[email protected]>
|
hello @jkroepke , thanks for your contribution! I think this would be a good idea, but the current PR breaks backwards compatibility. In the present form, all projects using the SDK would have to be adapted to the changed api. In order to go forward with this, the compatibility to existing projects would have to be maintained |
76c5906 to
6f7f005
Compare
|
Hi @bahkauv70 the current approach should preserve the backwards compatibility. |
|
Hi @jkroepke, Thanks for your contribution! The PR looks good. Only a nitpick, can you add some changelogs to these two files: https://github.com/stackitcloud/stackit-sdk-go/blob/main/core/CHANGELOG.md |
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
|
Hi, I added some test case to increase the test coverage. At least with that tests, I feel a bit more confident that everything still works. |
Signed-off-by: Jan-Otto Kröpke <[email protected]>
|
Hi, there are some linter issues which you can check here in the pipeline or you can run |
Signed-off-by: Jan-Otto Kröpke <[email protected]>
Signed-off-by: Jan-Otto Kröpke <[email protected]>
marceljk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution 😃
|
Hi! First I tried this which did not work (no credentials found): My initial workaround was: With this PR, though, using the existing transport from the httpClient is put in the NoAuth branch of execution, so I have to do this, to use is. Is this the intended way to use this? The The docstring for If this is still a bug and not just a misunderstanding on my part, I am happy to provide a PR. |
Hi,
I'm looking into setting up the discovery integration for STACKIT in prometheus/prometheus.
While the integration generally works fine, I encountered some issues injecting the http.RoundTripper from the Prometheus ecosystem into the SDK CLI.
Ref: https://github.com/jkroepke/prometheus/blob/8bec5e7cce575b18af42fe8cd67ee0fd5f47ac73/discovery/stackit/server.go#L91
It seems that each authentication method creates a new http.Client instead of simply extending the chain of RoundTripper functions.
This PR modifies the behavior so that the auth function accepts an existing http.RoundTripper and extends it, as is usual in the Go ecosystem.
Theoretically, this avoids the need for proprietary middleware approaches, as existing middleware can be injected through the Transport of a custom http.Client. That's how it usually works in the Go ecosystem.