-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Add a filter to support HTTP/JSON<->gRPC transcoding #1079
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
Changes from 24 commits
6572487
a8f8f33
579d342
118d1e7
ca46f94
8034159
77f9c00
dd68af1
8d235bd
98c5ccf
547b92f
8f1f307
b88b0d5
9850c9b
53fcf47
6be5d0d
ae9094f
13b66db
5eabe6f
5446914
db48843
f92d527
b68400e
cc27cec
c99496d
c45226a
3acba06
65567f4
41416cd
79791ab
af5ac95
b2265b0
ce354b4
8b154c7
6894025
efba771
80de522
2a35000
d41f9d9
38d08fa
c82fd4a
cdeb87d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .. _config_http_filters_grpc_json_transcoding: | ||
|
|
||
| gRPC-JSON transcoding filter | ||
| ============================ | ||
|
|
||
| gRPC :ref:`architecture overview <arch_overview_grpc>`. | ||
|
|
||
| This is a filter which enables the bridging of a JSON-REST client to a gRPC server. | ||
|
|
||
| .. code-block:: json | ||
|
|
||
| { | ||
| "type": "both", | ||
| "name": "grpc_json_transcoding", | ||
| "config": { | ||
| "proto_descriptors": "proto.pb", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'm a little confused about what this filter does. My understanding is that through reflection it can operate in a generic transcoding mode without knowing the pb definition ahead of time. Is that possible? I think many use cases are going to want that. Having to predefine the pb is kind of a pain from operations perspective. Do we predefine the pb so that we can do better error checking? (Maybe just related to needing more documentation).
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it is possible with grpc reflection, however we have no experience with that and reflection itself is still v1alpha. I will take this on later task, not in this PR. predefined pb doesn't provide better error checking. |
||
| "services": ["grpc.service.Service"] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,25 @@ envoy_cc_library( | |
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "transcoding_filter_lib", | ||
| srcs = ["transcoding_filter.cc"], | ||
| hdrs = ["transcoding_filter.h"], | ||
| external_deps = [ | ||
| "path_matcher", | ||
| "grpc_transcoding", | ||
| ], | ||
| deps = [ | ||
| ":codec_lib", | ||
| ":common_lib", | ||
| ":transcoder_input_stream_lib", | ||
| "//include/envoy/http:filter_interface", | ||
| "//source/common/common:base64_lib", | ||
| "//source/common/http:headers_lib", | ||
| "@googleapis//:http_api_protos", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't reference external deps like googleapis with "@googleapis", they need to appear in external_deps instead. We won't be able to perform the remapping during the Google import otherwise. |
||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "grpc_web_filter_lib", | ||
| srcs = ["grpc_web_filter.cc"], | ||
|
|
@@ -114,3 +133,13 @@ envoy_cc_library( | |
| "//source/common/buffer:zero_copy_input_stream_lib", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_library( | ||
| name = "transcoder_input_stream_lib", | ||
| srcs = ["transcoder_input_stream_impl.cc"], | ||
| hdrs = ["transcoder_input_stream_impl.h"], | ||
| external_deps = ["grpc_transcoding"], | ||
| deps = [ | ||
| "//source/common/buffer:zero_copy_input_stream_lib", | ||
| ], | ||
| ) | ||
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 don't think this is enough documentation for someone to actually use this filter effectively. Do you have any other documentation somewhere that we can link to? Otherwise, can we add some more documentation? And maybe do a follow up at some point with a full docker example? I think there should be some overview discussion of this functionality on this page also: https://lyft.github.io/envoy/docs/intro/arch_overview/grpc.html
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.
Sorry for the confusing PR, the docs was WIP, now it is ready, PTAL again.