-
Notifications
You must be signed in to change notification settings - Fork 5.5k
thrift: adding xDS RDS support for thrift proxy. #17631
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
Closed
Closed
Changes from 24 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
7448070
Adding xDS RDS support for thrift protocol.
eb5dc21
Fix generated_api_shadow
fcc2abf
Merge main
d1e2124
Fix missed file
4609c02
Fix conn_manager_test
f48daed
Fix router_ratelimit_test
0022eed
Fix clang_tidy
3235184
More type urls can identify the same RouteDiscoveryService endpoint
12aa485
Merge branch 'main' into add_thrift_rds
6506f20
Fix merge conflict resolution, add test
e9bb514
Dummy
b95bf8e
Merge branch 'main' into add_thrift_rds
fbf27dc
Template base classes for rds handling.
cd88857
Merge branch 'main' into add_thrift_rds_rework
aeb9476
Fix RouteConfigUpdateReceiverImpl::onVhdsUpdate
7811138
Fix clang-tidy errors
508f711
Fix clang-tidy errors, missing build dependencies
c28ff34
Merge branch 'main' into add_thrift_rds_rework
8ca0a4f
Debug strange lua filter coverage issue
639148d
Revert: Debug strange lua filter coverage issue
054460e
Separate service endpoint to Thrift rds
0695c52
Move service to thrift rds into api/envoy/services
15e1747
Kick CI
f6f111c
Simplifications
4414291
Merge branch 'main' into add_thrift_rds
b9ab26f
Add prefix to Thrift rds related proto names in the api.
44f9ea8
Fix missed file
4ae0e46
Kick CI
ab9e419
Kick CI
bbc830b
Change TRDS method names similar to other DS method names
cd7c2d7
Fix ut
8e9dbea
Merge branch 'main' into add_thrift_rds
7d93eb6
Eliminate templates from generic rds base classes.
22d91c7
Fix CI issues.
54090b2
Fix CI issues.
2e94bda
Fix CI issues.
d8b377f
Fix CI issues.
8209da5
Fix CI issues, clang-tidy.
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
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,14 @@ | ||
| # 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( | ||
| has_services = True, | ||
| deps = [ | ||
| "//envoy/annotations:pkg", | ||
| "//envoy/service/discovery/v3:pkg", | ||
| "@com_github_cncf_udpa//udpa/annotations:pkg", | ||
| ], | ||
| ) |
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,47 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.service.thrift_route.v3; | ||
|
|
||
| import "envoy/service/discovery/v3/discovery.proto"; | ||
|
|
||
| import "google/api/annotations.proto"; | ||
|
|
||
| import "envoy/annotations/resource.proto"; | ||
| import "udpa/annotations/status.proto"; | ||
| import "udpa/annotations/versioning.proto"; | ||
|
|
||
| option java_package = "io.envoyproxy.envoy.service.thrift_route.v3"; | ||
| option java_outer_classname = "RdsProto"; | ||
| option java_multiple_files = true; | ||
| option java_generic_services = true; | ||
| option (udpa.annotations.file_status).package_version_status = ACTIVE; | ||
|
|
||
| // [#protodoc-title: THRIFT_RDS] | ||
|
|
||
| // The resource_names field in DiscoveryRequest specifies a route configuration. | ||
| // This allows an Envoy configuration with multiple Thrift listeners (and | ||
| // associated Thrift proxy filters) to use different route | ||
| // configurations. Each listener will bind its Thrift proxy filter to | ||
| // a route table via this identifier. | ||
| service RouteDiscoveryService { | ||
|
tkovacs-2 marked this conversation as resolved.
Outdated
|
||
| option (envoy.annotations.resource).type = | ||
| "envoy.extensions.filters.network.thrift_proxy.v3.RouteConfiguration"; | ||
|
|
||
| rpc StreamRoutes(stream discovery.v3.DiscoveryRequest) | ||
| returns (stream discovery.v3.DiscoveryResponse) { | ||
| } | ||
|
|
||
| rpc DeltaRoutes(stream discovery.v3.DeltaDiscoveryRequest) | ||
| returns (stream discovery.v3.DeltaDiscoveryResponse) { | ||
| } | ||
|
|
||
| rpc FetchRoutes(discovery.v3.DiscoveryRequest) returns (discovery.v3.DiscoveryResponse) { | ||
| option (google.api.http).post = "/v3/discovery:thrift_routes"; | ||
| option (google.api.http).body = "*"; | ||
| } | ||
| } | ||
|
|
||
| // [#not-implemented-hide:] Not configuration. Workaround c++ protobuf issue with importing | ||
| // services: https://github.com/google/protobuf/issues/4221 and protoxform to upgrade the file. | ||
| message RdsDummy { | ||
|
tkovacs-2 marked this conversation as resolved.
Outdated
|
||
| } | ||
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,68 @@ | ||
| #pragma once | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "envoy/common/time.h" | ||
|
|
||
| #include "absl/types/optional.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Router { | ||
| namespace Rds { | ||
|
|
||
| /** | ||
| * A provider for constant route configurations. | ||
| */ | ||
| template <class RouteConfiguration, class Config> class RouteConfigProvider { | ||
|
tkovacs-2 marked this conversation as resolved.
Outdated
|
||
| public: | ||
| struct ConfigInfo { | ||
| // A reference to the currently loaded route configuration. Do not hold this reference beyond | ||
| // the caller of configInfo()'s scope. | ||
| const RouteConfiguration& config_; | ||
|
|
||
| // The discovery version that supplied this route. This will be set to "" in the case of | ||
| // static clusters. | ||
| std::string version_; | ||
| }; | ||
|
|
||
| virtual ~RouteConfigProvider() = default; | ||
|
|
||
| /** | ||
| * @return Router::ConfigConstSharedPtr a route configuration for use during a single request. The | ||
| * returned config may be different on a subsequent call, so a new config should be acquired for | ||
| * each request flow. | ||
| */ | ||
| virtual std::shared_ptr<const Config> config() PURE; | ||
|
|
||
| /** | ||
| * @return the configuration information for the currently loaded route configuration. Note that | ||
| * if the provider has not yet performed an initial configuration load, no information will be | ||
| * returned. | ||
| */ | ||
| virtual absl::optional<ConfigInfo> configInfo() const PURE; | ||
|
|
||
| /** | ||
| * @return the last time this RouteConfigProvider was updated. Used for config dumps. | ||
| */ | ||
| virtual SystemTime lastUpdated() const PURE; | ||
|
|
||
| /** | ||
| * Callback used to notify RouteConfigProvider about configuration changes. | ||
| */ | ||
| virtual void onConfigUpdate() PURE; | ||
|
|
||
| /** | ||
| * Validate if the route configuration can be applied to the context of the route config provider. | ||
| */ | ||
| virtual void validateConfig(const RouteConfiguration& config) const PURE; | ||
| }; | ||
|
|
||
| template <class RouteConfiguration, class Config> | ||
| using RouteConfigProviderPtr = std::unique_ptr<RouteConfigProvider<RouteConfiguration, Config>>; | ||
| template <class RouteConfiguration, class Config> | ||
| using RouteConfigProviderSharedPtr = | ||
| std::shared_ptr<RouteConfigProvider<RouteConfiguration, Config>>; | ||
|
|
||
| } // namespace Rds | ||
| } // namespace Router | ||
| } // namespace Envoy | ||
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,75 @@ | ||
| #pragma once | ||
|
|
||
| #include <memory> | ||
|
|
||
| #include "envoy/common/pure.h" | ||
| #include "envoy/common/time.h" | ||
| #include "envoy/router/rds/route_config_provider.h" | ||
|
|
||
| #include "absl/types/optional.h" | ||
|
|
||
| namespace Envoy { | ||
| namespace Router { | ||
| namespace Rds { | ||
|
|
||
| /** | ||
| * A primitive that keeps track of updates to a RouteConfiguration. | ||
| */ | ||
| template <class RouteConfiguration, class Config> class RouteConfigUpdateReceiver { | ||
| public: | ||
| virtual ~RouteConfigUpdateReceiver() = default; | ||
|
|
||
| /** | ||
| * Called on updates via RDS. | ||
| * @param rc supplies the RouteConfiguration. | ||
| * @param version_info supplies RouteConfiguration version. | ||
| * @return bool whether RouteConfiguration has been updated. | ||
| */ | ||
| virtual bool onRdsUpdate(const RouteConfiguration& rc, const std::string& version_info) PURE; | ||
|
|
||
| /** | ||
| * @return std::string& the name of RouteConfiguration. | ||
| */ | ||
| virtual const std::string& routeConfigName() const PURE; | ||
|
|
||
| /** | ||
| * @return std::string& the version of RouteConfiguration. | ||
| */ | ||
| virtual const std::string& configVersion() const PURE; | ||
|
|
||
| /** | ||
| * @return uint64_t the hash value of RouteConfiguration. | ||
| */ | ||
| virtual uint64_t configHash() const PURE; | ||
|
|
||
| /** | ||
| * @return absl::optional<RouteConfigProvider::ConfigInfo> containing an instance of | ||
| * RouteConfigProvider::ConfigInfo if RouteConfiguration has been updated at least once. Otherwise | ||
| * returns an empty absl::optional<RouteConfigProvider::ConfigInfo>. | ||
| */ | ||
| virtual absl::optional<typename RouteConfigProvider<RouteConfiguration, Config>::ConfigInfo> | ||
| configInfo() const PURE; | ||
|
|
||
| /** | ||
| * @return envoy::config::route::v3::RouteConfiguration& current RouteConfiguration. | ||
| */ | ||
| virtual const RouteConfiguration& protobufConfiguration() PURE; | ||
|
|
||
| /** | ||
| * @return Router::ConfigConstSharedPtr a parsed and validated copy of current RouteConfiguration. | ||
| * @see protobufConfiguration() | ||
| */ | ||
| virtual std::shared_ptr<const Config> parsedConfiguration() const PURE; | ||
|
|
||
| /** | ||
| * @return SystemTime the time of the last update. | ||
| */ | ||
| virtual SystemTime lastUpdated() const PURE; | ||
| }; | ||
|
|
||
| template <class RouteConfiguration, class Config> | ||
| using RouteConfigUpdatePtr = std::unique_ptr<RouteConfigUpdateReceiver<RouteConfiguration, Config>>; | ||
|
|
||
| } // namespace Rds | ||
| } // namespace Router | ||
| } // namespace Envoy |
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.