-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Feature: Golang Http Tcp Bridge #36667
Conversation
Signed-off-by: duxin40 <[email protected]>
support golang tcp extension for http2tcp
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
I will add unit tests for these codes and fix errors related to unit tests. |
@doujiang24 could you take a look and check if the direction looks good? thanks! |
/assign @doujiang24 Per discussion in #35749 |
@duxin40 cannot be assigned to this issue. |
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.
Better add a simple example that use Golang to implement http => TCP protocol, to show how it could be for users for easier understanding.
It do not need to be runable, just a demo.
api/contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha/BUILD
Outdated
Show resolved
Hide resolved
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
} | ||
|
||
void TcpUpstream::encodeTrailers(const Envoy::Http::RequestTrailerMap&) { | ||
Buffer::OwnedImpl data; |
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.
ditto, we'd better golang convert trailers to data buffer, but we can just add a TODO for it now, it's not a common use case.
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.
got it, will finish it in the near future.
contrib/golang/upstreams/http/tcp/test/test_data/http2dubbo-example/README.md
Outdated
Show resolved
Hide resolved
…om response header in envoyGoOnUpstreamData Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Docs for this Pull Request will be rendered here: https://storage.googleapis.com/envoy-pr/36667/docs/index.html The docs are (re-)rendered each time the CI |
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
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 working on this @duxin40
@@ -179,3 +179,73 @@ updates: | |||
schedule: | |||
interval: daily | |||
time: "06:00" | |||
|
|||
- package-ecosystem: "gomod" |
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.
it this still required? afaict this uses the same deps that have been merged, surely we can use an existing go.mod?
api/contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha/golang.proto
Outdated
Show resolved
Hide resolved
api/contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha/golang.proto
Outdated
Show resolved
Hide resolved
api/contrib/envoy/extensions/upstreams/http/tcp/golang/v3alpha/golang.proto
Outdated
Show resolved
Hide resolved
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
Signed-off-by: duxin40 <[email protected]>
/retest |
I don't have time to review this giant PR. Will merge once @doujiang24 and @phlax give the ok. /wait-any |
Signed-off-by: duxin40 <[email protected]>
Get it, here is the success result for asan mode:
|
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.
@duxin40 if you can merge main i will land this |
/retest |
@doujiang24 @phlax thanks so much for your patience and review for the gaint PR in the past three months !!! |
As mentioned in the proposal: envoyproxy#35749 , this PR is to support using Golang to extend TCP upstream proxy, to make changes to connections and data messages in the http2tcp situation of envoy. (this PR does) ### Here is my thought about Golang extension function points: 1. Support encoding message processing for upstream TCP requests (route and cluster have been determined, and targeted message processing can be performed for route and cluster) 2. Support the handling of conn connection status during the encoding stage of upstream TCP requests (for example, by setting end_stream=false to avoid envoy semi connected status) 3. Support decoding message processing and aggregation for upstream TCP response in onUpstreamData.(for example, by setting end_stream=true to indicate that the message is encapsulated and can be passed to downstream) 4. Aggregate the tcp messages received multiple times by onUpstreamData of tcp response. 5. Support obtaining route and cluster information, which can be referenced for targeted processing in the above stages. ### What we can do with this Golang extension: With this golang extension, developers can quickly get started with envoy and use golang to implement http2tcp such as http2dubbo、http2rpc. Signed-off-by: duxin40 <[email protected]> Signed-off-by: duxin40 <[email protected]>
As mentioned in the proposal: #35749 , this PR is to support using Golang to extend TCP upstream proxy, to make changes to connections and data messages in the http2tcp situation of envoy.
(this PR does)
Here is my thought about Golang extension function points:
What we can do with this Golang extension:
With this golang extension, developers can quickly get started with envoy and use golang to implement http2tcp such as http2dubbo、http2rpc.
Commit Message: support Golang TCP Upstream Extension for http2tcp on Envoy
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #Issue]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]