Skip to content
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

add http2 listener for grpc proxy #315

Merged
merged 24 commits into from
Jan 3, 2022
Merged

Conversation

ztelur
Copy link
Contributor

@ztelur ztelur commented Dec 5, 2021

What this PR does:

  • add listener interface
  • add http2 listener for grpc proxy
  • change listener parameter 'filter-chains'
  • add grpc proxy samples

具体修改

1 将 Listener 提取出 interface,方便对不同协议扩展,目前有 HTTP 和 HTTP2两个struct

详见 pkg/listener/http2/http2_listener.go 分别进行不同的监听

2 实现 GrpcConnectionManager 这个 NetworkFilter,和旧的 HttpConnectionManager 是并列的。

将接收到的 HTTP2 request 进行拷贝,根据path选取cluster和endpoint,使用http2connection发送拷贝后的request给upstream grpc 服务器,然后将response的header,statuscode,body和tailor写回到给客户端的 response中
详见 pkg/common/grpc/manager.go

3 配置文件修改,将 protocolType 从 Address 提升到 Listener,将FilterChain从数组改变成单独结构体(P.S. 主要change来源这里,因为改了大量配置文件)

详见 pkg/filterchain/filter_chain.go

image

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2021

Codecov Report

Merging #315 (b3d5810) into develop (c3fa875) will increase coverage by 1.06%.
The diff coverage is 10.41%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #315      +/-   ##
===========================================
+ Coverage    38.89%   39.96%   +1.06%     
===========================================
  Files           53       53              
  Lines         3121     3038      -83     
===========================================
  Hits          1214     1214              
+ Misses        1778     1694      -84     
- Partials       129      130       +1     
Impacted Files Coverage Δ
pkg/common/extension/filter/filter.go 29.16% <ø> (ø)
pkg/context/http/context.go 0.00% <ø> (ø)
pkg/listener/listener.go 0.00% <0.00%> (ø)
pkg/server/listener_manager.go 0.00% <0.00%> (ø)
pkg/common/http/manager.go 44.00% <10.00%> (-10.10%) ⬇️
pkg/common/router/router.go 68.62% <28.57%> (-5.85%) ⬇️
pkg/config/config_load.go 68.81% <33.33%> (ø)
pkg/listener/http/http_listener.go

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c3fa875...b3d5810. Read the comment docs.

@AlexStocks
Copy link
Contributor

Pls fix the problems from github action robot.

@AlexStocks
Copy link
Contributor

pls fix the conflicts.

# Conflicts:
#	pkg/listener/http/http_listener.go
pkg/listener/http2/http2_listener.go Outdated Show resolved Hide resolved
pkg/listener/http2/http2_listener.go Show resolved Hide resolved
pkg/listener/http2/http2_listener.go Show resolved Hide resolved
pkg/server/listener_manager.go Show resolved Hide resolved
- filter_chain_match:
domains:
- api.dubbo.com
- api.pixiu.com
filters:
- name: dgp.filter.httpconnectionmanager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as above, using its abbrevlation instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

following envoy http_connection_manager. hcm or gcm for grpcconnectionmanager make too much information lost

samples/grpc/server/app/server.go Show resolved Hide resolved
Copy link
Member

@mark4z mark4z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job

pkg/common/grpc/manager.go Outdated Show resolved Hide resolved
pkg/common/grpc/manager.go Outdated Show resolved Hide resolved
pkg/filterchain/filter_chain.go Outdated Show resolved Hide resolved
@ztelur ztelur merged commit 7946f64 into apache:develop Jan 3, 2022
bobtthp pushed a commit to bobtthp/dubbo-go-pixiu that referenced this pull request Dec 12, 2022
* split listener service interface

* split listener service interface

* update

* update

* update

* update

* add integration test

* add integration test

* update

* fix golangci-lint

* update

* fix reviewdog

* fix reviewdog

* fix reviewdog

* update for comment

* rename to NetworkFilterChain

* update

Co-authored-by: Mark4z <36187602+mark4z@users.noreply.github.com>
Co-authored-by: Xin.Zh <dragoncharlie@foxmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants