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
pass headers to reflection client #351
Conversation
c500680
to
6ec1a38
Compare
Codecov Report
@@ Coverage Diff @@
## master #351 +/- ##
==========================================
+ Coverage 80.29% 80.31% +0.01%
==========================================
Files 57 57
Lines 2736 2738 +2
==========================================
+ Hits 2197 2199 +2
Misses 309 309
Partials 230 230 |
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 submitting the PR.
Most of the changes, and the policy of not changing the command interface, are completely in line with my assumptions!
I suggested a nitpick change, so could you take a look?
grpc/grpcreflection/reflection.go
Outdated
md := metadata.New(nil) | ||
for k, v := range headers { | ||
md.Append(k, v...) | ||
} | ||
return metadata.NewOutgoingContext(context.Background(), md) |
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.
md := metadata.New(nil) | |
for k, v := range headers { | |
md.Append(k, v...) | |
} | |
return metadata.NewOutgoingContext(context.Background(), md) | |
return metadata.NewOutgoingContext(context.Background(), metadata.MD(headers)) |
5e81a50
to
ab5c40e
Compare
Thanks for the review, I addressed the comment and squashed the commits. Let me know if there is something else you need. |
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.
LGTM, thanks for your contribution!
Fixes #347
So we just run into this problem. We have several services behind traefik and we distinguish between them by their service/package. However, because reflection runs on its own service/package namespace this doesn't work as there is no way of telling which service it's supposed to be querying to. To solve that we added a header to redirect to one service or another but evans doesn't pass the specified header to the reflection clients.
This PR takes the headers specified via the command line and passes them to the reflection clients, it doesn't introduce any new flag or modify any other behavior.
Not sure if this is how you wanted to solve this problem or if someone is working on this already but as I needed something quick I figured I'd fixed and open a PR to kick the discussion.
thanks