-
Notifications
You must be signed in to change notification settings - Fork 5.5k
transport sockets: support passthrough state for internal connections #19435
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
Merged
Merged
Changes from 10 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
5c04df2
internal listener: add metadata passthrough
kyessenov 2d97b10
fix
kyessenov 4b48cf8
fix
kyessenov cad2834
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 9210c0d
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 20ef02a
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov c179148
review
kyessenov de4bb84
oops
kyessenov 2a0baae
impl
kyessenov 28a8a95
impl
kyessenov a0eedce
fix metadata
kyessenov 942a0de
wire server
kyessenov 1901fbb
docs broke
kyessenov 71c4177
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 4f6402f
fix a bug and validate
kyessenov c645110
fix docs
kyessenov 8373eff
fix static initialization
kyessenov 168b782
fix build
kyessenov ff75d61
typo
kyessenov fabb13e
fix test
kyessenov 5b54ed1
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 3b2201f
fix
kyessenov 961cfb7
merge main
kyessenov 4fb2e84
try CI
kyessenov d3a6fad
support filter state
kyessenov d9d8690
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 3e9c0f2
rollback
kyessenov 5799114
fixes
kyessenov f1525f4
fix proto
kyessenov eb69dde
fix conflict
kyessenov a9bd24e
wip
kyessenov a651261
changes
kyessenov 0a9bf76
check spell
kyessenov 9dadef2
resolve dependency loop
kyessenov 7ae5f85
wip
kyessenov 0ddf84a
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov b45efb9
add unit test
kyessenov 6c9a0f1
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov cb37fba
review
kyessenov b8711ce
integration test
kyessenov 27b3d14
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 9afbbaf
bad release
kyessenov 84b3c91
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov bf02b8a
fix test
kyessenov f1aeaa7
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 76da2ca
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 648dd85
review
kyessenov 112cf60
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov a2da357
fix deprecated feature use
kyessenov 5dfab49
fix deprecated feature use
kyessenov 8d1ed10
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 5eba0e9
API review feedback
kyessenov 1381639
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov b3b1b1d
add filter state to integration test
kyessenov 2012ba5
coverage
kyessenov 37cda51
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov cc74397
update docs
kyessenov 0bd2862
merge fix
kyessenov 7bec6ea
merge fix
kyessenov e3942cb
build again
kyessenov 7c97a8a
change signature of createTransportSocket
kyessenov 47f422a
test on CI
kyessenov 990bf13
add docs
kyessenov 7aec8ee
Merge remote-tracking branch 'upstream/main' into internal_address_me…
kyessenov 1249d5e
merge fix
kyessenov b41b932
fix format
kyessenov 0192bbd
merge fix
kyessenov 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 hidden or 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 hidden or 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,13 @@ | ||
| # DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. | ||
|
|
||
| load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| api_proto_package( | ||
| deps = [ | ||
| "//envoy/config/core/v3:pkg", | ||
| "//envoy/type/metadata/v3:pkg", | ||
| "@com_github_cncf_udpa//udpa/annotations:pkg", | ||
| ], | ||
| ) |
39 changes: 39 additions & 0 deletions
39
api/envoy/extensions/transport_sockets/internal/v3/internal_upstream.proto
This file contains hidden or 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,39 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.extensions.transport_sockets.internal.v3; | ||
|
|
||
| import "envoy/config/core/v3/base.proto"; | ||
| import "envoy/type/metadata/v3/metadata.proto"; | ||
|
|
||
| import "udpa/annotations/status.proto"; | ||
| import "validate/validate.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.extensions.transport_sockets.internal.v3"; | ||
| option java_outer_classname = "InternalUpstreamProto"; | ||
| option java_multiple_files = true; | ||
| option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/internal/v3;internalv3"; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
|
||
| // [#protodoc-title: Internal Upstream] | ||
| // [#extension: envoy.transport_sockets.internal_upstream] | ||
|
|
||
| // Configuration for the internal upstream address. An internal address is a | ||
| // loopback user space socket residing in the same proxy instance. | ||
| // [#not-implemented-hide:] | ||
| message InternalUpstreamTransport { | ||
| // Describes the location of the metadata value in the upstream cluster context. | ||
| message MetadataValueSource { | ||
| // Specifies what kind of metadata. | ||
| type.metadata.v3.MetadataKind kind = 1; | ||
|
|
||
| // Name is the filter namespace used in the dynamic metadata. | ||
|
kyessenov marked this conversation as resolved.
|
||
| string name = 2 [(validate.rules).string = {min_len: 1}]; | ||
| } | ||
|
|
||
| // Specifies the metadata namespaces and values to insert into the downstream | ||
| // internal connection dynamic metadata when an internal address is used as a host. | ||
| map<string, MetadataValueSource> passthrough_metadata = 1; | ||
|
|
||
| // The underlying transport socket being wrapped. | ||
| config.core.v3.TransportSocket transport_socket = 2 [(validate.rules).message = {required: true}]; | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -277,9 +277,10 @@ Network::TransportSocketFactory& HostDescriptionImpl::resolveTransportSocketFact | |
| Host::CreateConnectionData HostImpl::createConnection( | ||
| Event::Dispatcher& dispatcher, const Network::ConnectionSocket::OptionsSharedPtr& options, | ||
| Network::TransportSocketOptionsConstSharedPtr transport_socket_options) const { | ||
| return {createConnection(dispatcher, cluster(), address(), addressList(), | ||
| transportSocketFactory(), options, transport_socket_options), | ||
| shared_from_this()}; | ||
| HostDescriptionConstSharedPtr host = shared_from_this(); | ||
| return {createConnection(dispatcher, host, transportSocketFactory(), options, | ||
| transport_socket_options, false), | ||
| host}; | ||
| } | ||
|
|
||
| void HostImpl::setEdsHealthFlag(envoy::config::core::v3::HealthStatus health_status) { | ||
|
|
@@ -308,19 +309,19 @@ Host::CreateConnectionData HostImpl::createHealthCheckConnection( | |
| Network::TransportSocketFactory& factory = | ||
| (metadata != nullptr) ? resolveTransportSocketFactory(healthCheckAddress(), metadata) | ||
| : transportSocketFactory(); | ||
| return {createConnection(dispatcher, cluster(), healthCheckAddress(), {}, factory, nullptr, | ||
| transport_socket_options), | ||
| shared_from_this()}; | ||
| } | ||
|
|
||
| Network::ClientConnectionPtr HostImpl::createConnection( | ||
| Event::Dispatcher& dispatcher, const ClusterInfo& cluster, | ||
| const Network::Address::InstanceConstSharedPtr& address, | ||
| const std::vector<Network::Address::InstanceConstSharedPtr>& address_list, | ||
| Network::TransportSocketFactory& socket_factory, | ||
| const Network::ConnectionSocket::OptionsSharedPtr& options, | ||
| Network::TransportSocketOptionsConstSharedPtr transport_socket_options) { | ||
| HostDescriptionConstSharedPtr host = shared_from_this(); | ||
| return {createConnection(dispatcher, host, factory, nullptr, transport_socket_options, true), | ||
| host}; | ||
| } | ||
|
|
||
| Network::ClientConnectionPtr | ||
| HostImpl::createConnection(Event::Dispatcher& dispatcher, HostDescriptionConstSharedPtr& host, | ||
| Network::TransportSocketFactory& socket_factory, | ||
| const Network::ConnectionSocket::OptionsSharedPtr& options, | ||
| Network::TransportSocketOptionsConstSharedPtr transport_socket_options, | ||
| bool health_check) { | ||
| Network::ConnectionSocket::OptionsSharedPtr connection_options; | ||
| const auto& cluster = host->cluster(); | ||
| if (cluster.clusterSocketOptions() != nullptr) { | ||
| if (options) { | ||
| connection_options = std::make_shared<Network::ConnectionSocket::Options>(); | ||
|
|
@@ -334,17 +335,24 @@ Network::ClientConnectionPtr HostImpl::createConnection( | |
| connection_options = options; | ||
| } | ||
|
|
||
| const auto& address = health_check ? host->healthCheckAddress() : host->address(); | ||
| const auto& address_list = | ||
| health_check ? std::vector<Network::Address::InstanceConstSharedPtr>() : host->addressList(); | ||
|
|
||
| ASSERT(!address->envoyInternalAddress() || | ||
| Runtime::runtimeFeatureEnabled("envoy.reloadable_features.internal_address")); | ||
|
|
||
| auto host_transport_socket_options = | ||
|
kyessenov marked this conversation as resolved.
Outdated
|
||
| std::make_shared<Network::HostDecoratingTransportSocketOptions>(host, | ||
| transport_socket_options); | ||
| Network::ClientConnectionPtr connection = | ||
| address_list.size() > 1 | ||
| ? std::make_unique<Network::HappyEyeballsConnectionImpl>( | ||
| dispatcher, address_list, cluster.sourceAddress(), socket_factory, | ||
| transport_socket_options, connection_options) | ||
| host_transport_socket_options, connection_options) | ||
|
Contributor
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. nit: I think std::move(host_transport_socket_options) should works here
Contributor
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. right, I did move it in the other clause. |
||
| : dispatcher.createClientConnection( | ||
| address, cluster.sourceAddress(), | ||
| socket_factory.createTransportSocket(std::move(transport_socket_options)), | ||
| socket_factory.createTransportSocket(std::move(host_transport_socket_options)), | ||
| connection_options); | ||
|
|
||
| connection->setBufferLimits(cluster.perConnectionBufferLimitBytes()); | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,40 @@ | ||
| load( | ||
| "//bazel:envoy_build_system.bzl", | ||
| "envoy_cc_extension", | ||
| "envoy_cc_library", | ||
| "envoy_extension_package", | ||
| ) | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| envoy_extension_package() | ||
|
|
||
| envoy_cc_library( | ||
| name = "internal_lib", | ||
| srcs = ["internal.cc"], | ||
| hdrs = ["internal.h"], | ||
| deps = [ | ||
| "//envoy/network:transport_socket_interface", | ||
| "//envoy/upstream:host_description_interface", | ||
| "//envoy/upstream:upstream_interface", | ||
| "//source/common/common:assert_lib", | ||
| "//source/common/common:minimal_logger_lib", | ||
| "//source/common/protobuf:utility_lib", | ||
| "//source/extensions/io_socket/user_space:io_handle_lib", | ||
| "//source/extensions/transport_sockets/common:passthrough_lib", | ||
| "@envoy_api//envoy/extensions/transport_sockets/internal/v3:pkg_cc_proto", | ||
| ], | ||
| ) | ||
|
|
||
| envoy_cc_extension( | ||
| name = "config", | ||
| srcs = ["config.cc"], | ||
| hdrs = ["config.h"], | ||
| deps = [ | ||
| ":internal_lib", | ||
| "//envoy/registry", | ||
| "//envoy/server:transport_socket_config_interface", | ||
| "//source/common/config:utility_lib", | ||
| "@envoy_api//envoy/extensions/transport_sockets/internal/v3:pkg_cc_proto", | ||
| ], | ||
| ) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.