client: allow grpc dial option passthrough#3740
Merged
tonistiigi merged 1 commit intomoby:masterfrom Mar 27, 2023
Merged
Conversation
tonistiigi
approved these changes
Mar 24, 2023
crazy-max
approved these changes
Mar 24, 2023
This allows consumers of buildkit's client API to manually specify grpc
options, such as underlying transport details, or creating interceptors
for requests. All custom options are appended *after* the internal
options, to allow for more specific overrides if desired.
Additionally, to prevent accidentally overwriding the internal
interceptors, we switch the client to using
`WithChain{Unary,Stream}Interceptor` instead of the singular form, which
will overwrite if multiple are specified.
Signed-off-by: Justin Chadwell <me@jedevc.com>
b999f4d to
17df884
Compare
Member
Author
|
Woops, I did some testing and figured out that this isn't quite right, we want to apply all the options at the end, instead of possibly in-between other options. We also need to change the method used to create unary and stream interceptors, so that we don't accidentally override the previous ones. I also added a test to make sure that the options are processed and that we can add new interceptors. |
crazy-max
approved these changes
Mar 27, 2023
tonistiigi
approved these changes
Mar 27, 2023
|
|
||
| contentapi "github.com/containerd/containerd/api/services/content/v1" | ||
| "github.com/containerd/containerd/defaults" | ||
| grpc_middleware "github.com/grpc-ecosystem/go-grpc-middleware" |
Member
There was a problem hiding this comment.
Follow-up: can we now remove all other usage of grpc_middleware as well?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows consumers of buildkit's client API to manually specify grpc options, such as underlying transport details, or creating interceptors for requests.
Some example use cases:
Maybe this isn't the right approach? If we're interested in manually setting headers, maybe we would want a dedicated
ClientOpttype?