-
Notifications
You must be signed in to change notification settings - Fork 69
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
Adding grpc_cluster client and server middleware #640
Conversation
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
528308b
to
4885c0c
Compare
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
4885c0c
to
b5ceef9
Compare
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.
Generally LGTM, but please see comments.
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
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.
I find the handling of empty and not defined cluster metadata unnecessarily complicated, I think the two cases can be handled as the same. WDYT?
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
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.
Mostly fine, but there's an extra if
left behind.
Signed-off-by: Yuri Nikolic <durica.nikolic@grafana.com>
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!
What this PR does:
This PR introduces 2 gRPC middlewares:
grpc.UnaryClientInterceptor
, that propagates a given cluster info to the outgoing gRPC metadata.grpc.UnaryServerInterceptor
, that checks if the incoming gRPC metadata contain any cluster information and if so, checks if the latter corresponds to the given cluster info. If it is the case, the request is further propagated. Otherwise, an error is returned.Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]