-
Notifications
You must be signed in to change notification settings - Fork 78
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
lazyload using envoy as global sidecar to support h1/h2 #375
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
8af8bf6
add slime envoy
Patrick0308 19dbdab
fix cluster-global-sidecar ns
Patrick0308 f5f9af3
delete slime-orig-dest header
Patrick0308 ba8b4bb
not append header value
Patrick0308 3c6422a
support short name
Patrick0308 b1f4907
not append value
Patrick0308 fd2cedf
support auto discovery grpc port and http2 port
Patrick0308 7868cf8
support service cache grpc port and http2 port
Patrick0308 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
staging/src/slime.io/slime/modules/lazyload/cmd/envoyproxy/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM envoyproxy/envoy:v1.26-latest | ||
|
||
WORKDIR / | ||
|
||
COPY proxy.yaml . | ||
|
||
ENTRYPOINT ["envoy","-c","./proxy.yaml"] |
115 changes: 115 additions & 0 deletions
115
staging/src/slime.io/slime/modules/lazyload/cmd/envoyproxy/proxy.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
static_resources: | ||
listeners: | ||
- address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 20000 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
access_log: | ||
- name: envoy.access_loggers.stdout | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog | ||
codec_type: AUTO | ||
stat_prefix: health | ||
use_remote_address: true | ||
route_config: | ||
name: health | ||
virtual_hosts: | ||
- name: all | ||
domains: | ||
- "*" | ||
routes: | ||
- match: | ||
prefix: "/" | ||
direct_response: | ||
status: 200 | ||
body: | ||
inline_string: "success" | ||
http_filters: | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
- address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 80 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
codec_type: AUTO | ||
access_log: | ||
- name: envoy.access_loggers.stdout | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog | ||
stat_prefix: egress_http | ||
common_http_protocol_options: | ||
idle_timeout: 840s | ||
use_remote_address: true | ||
route_config: | ||
name: proxy | ||
request_headers_to_remove: | ||
- "Slime-Orig-Dest" | ||
virtual_hosts: | ||
- name: all | ||
domains: | ||
- "*" | ||
routes: | ||
- match: | ||
prefix: "/" | ||
route: | ||
cluster: original_dst_cluster | ||
http_filters: | ||
- name: envoy.filters.http.lua | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.lua.v3.Lua | ||
default_source_code: | ||
YonkaFang marked this conversation as resolved.
Show resolved
Hide resolved
|
||
inline_string: | ||
function insert_namespace(host, namespace) | ||
if string.find(host, '%.') then | ||
return host | ||
end | ||
if not namespace or namespace == '' then | ||
return host | ||
end | ||
local idx = string.find(host, ':') | ||
if idx then | ||
local prefix = string.sub(host, 1, idx-1) | ||
local suffix = string.sub(host, idx) | ||
return prefix .. "." .. namespace .. suffix | ||
end | ||
return host .. '.' .. namespace | ||
end | ||
|
||
function envoy_on_request(request_handle) | ||
local sourceNs = request_handle:headers():get("Slime-Source-Ns") | ||
local reqHost = request_handle:headers():get(":authority") | ||
reqHost = insert_namespace(reqHost, sourceNs) | ||
request_handle:headers():replace(":authority", reqHost) | ||
end | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
clusters: | ||
- cleanupInterval: 8640000s | ||
connectTimeout: 10s | ||
lbPolicy: CLUSTER_PROVIDED | ||
name: original_dst_cluster | ||
type: ORIGINAL_DST | ||
original_dst_lb_config: | ||
use_http_header: true | ||
http_header_name: "Slime-Orig-Dest" | ||
typedExtensionProtocolOptions: | ||
envoy.extensions.upstreams.http.v3.HttpProtocolOptions: | ||
'@type': type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions | ||
useDownstreamProtocolConfig: | ||
http2ProtocolOptions: | ||
maxConcurrentStreams: 1073741824 | ||
httpProtocolOptions: {} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
又验证了下,下发这个dr后
看起来不需要再修改global-sidecar 为http2-80
grpc请求兜底到global-sidecar
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.
这个等我有空在确认一下