diff --git a/source/common/config/subscription_factory_impl.cc b/source/common/config/subscription_factory_impl.cc index ad28b13ce7e3..12a41c33a428 100644 --- a/source/common/config/subscription_factory_impl.cc +++ b/source/common/config/subscription_factory_impl.cc @@ -42,7 +42,6 @@ SubscriptionPtr SubscriptionFactoryImpl::subscriptionFromConfigSource( Utility::checkApiConfigSourceSubscriptionBackingCluster(cm_.primaryClusters(), api_config_source); Utility::checkTransportVersion(api_config_source); - const auto transport_api_version = envoy::config::core::v3::ApiVersion::V3; switch (api_config_source.api_type()) { case envoy::config::core::v3::ApiConfigSource::DEPRECATED_AND_UNAVAILABLE_DO_NOT_USE: throw EnvoyException( @@ -53,9 +52,9 @@ SubscriptionPtr SubscriptionFactoryImpl::subscriptionFromConfigSource( return std::make_unique( local_info_, cm_, api_config_source.cluster_names()[0], dispatcher_, api_.randomGenerator(), Utility::apiConfigSourceRefreshDelay(api_config_source), - Utility::apiConfigSourceRequestTimeout(api_config_source), - restMethod(type_url, transport_api_version), type_url, callbacks, resource_decoder, stats, - Utility::configSourceInitialFetchTimeout(config), validation_visitor_); + Utility::apiConfigSourceRequestTimeout(api_config_source), restMethod(type_url), type_url, + callbacks, resource_decoder, stats, Utility::configSourceInitialFetchTimeout(config), + validation_visitor_); case envoy::config::core::v3::ApiConfigSource::GRPC: return std::make_unique( std::make_shared( @@ -63,8 +62,8 @@ SubscriptionPtr SubscriptionFactoryImpl::subscriptionFromConfigSource( Utility::factoryForGrpcApiConfigSource(cm_.grpcAsyncClientManager(), api_config_source, scope, true) ->createUncachedRawAsyncClient(), - dispatcher_, sotwGrpcMethod(type_url, transport_api_version), api_.randomGenerator(), - scope, Utility::parseRateLimitSettings(api_config_source), + dispatcher_, sotwGrpcMethod(type_url), api_.randomGenerator(), scope, + Utility::parseRateLimitSettings(api_config_source), api_config_source.set_node_on_first_message_only()), callbacks, resource_decoder, stats, type_url, dispatcher_, Utility::configSourceInitialFetchTimeout(config), @@ -75,8 +74,8 @@ SubscriptionPtr SubscriptionFactoryImpl::subscriptionFromConfigSource( Config::Utility::factoryForGrpcApiConfigSource(cm_.grpcAsyncClientManager(), api_config_source, scope, true) ->createUncachedRawAsyncClient(), - dispatcher_, deltaGrpcMethod(type_url, transport_api_version), api_.randomGenerator(), - scope, Utility::parseRateLimitSettings(api_config_source), local_info_), + dispatcher_, deltaGrpcMethod(type_url), api_.randomGenerator(), scope, + Utility::parseRateLimitSettings(api_config_source), local_info_), callbacks, resource_decoder, stats, type_url, dispatcher_, Utility::configSourceInitialFetchTimeout(config), /*is_aggregated*/ false, options); } @@ -133,9 +132,8 @@ SubscriptionPtr SubscriptionFactoryImpl::collectionSubscriptionFromUrl( Config::Utility::factoryForGrpcApiConfigSource(cm_.grpcAsyncClientManager(), api_config_source, scope, true) ->createUncachedRawAsyncClient(), - dispatcher_, deltaGrpcMethod(type_url, envoy::config::core::v3::ApiVersion::V3), - api_.randomGenerator(), scope, Utility::parseRateLimitSettings(api_config_source), - local_info_), + dispatcher_, deltaGrpcMethod(type_url), api_.randomGenerator(), scope, + Utility::parseRateLimitSettings(api_config_source), local_info_), callbacks, resource_decoder, stats, dispatcher_, Utility::configSourceInitialFetchTimeout(config), false, options); } diff --git a/source/common/config/type_to_endpoint.cc b/source/common/config/type_to_endpoint.cc index 1add1d4661ef..655c429f9b4b 100644 --- a/source/common/config/type_to_endpoint.cc +++ b/source/common/config/type_to_endpoint.cc @@ -92,26 +92,19 @@ TypeUrlToV3ServiceMap& typeUrlToV3ServiceMap() { } // namespace -// TODO(alyssawilk) clean up transport_api_version argument. -const Protobuf::MethodDescriptor& -deltaGrpcMethod(absl::string_view type_url, - envoy::config::core::v3::ApiVersion /*transport_api_version*/) { +const Protobuf::MethodDescriptor& deltaGrpcMethod(absl::string_view type_url) { const auto it = typeUrlToV3ServiceMap().find(static_cast(type_url)); ASSERT(it != typeUrlToV3ServiceMap().cend()); return *Protobuf::DescriptorPool::generated_pool()->FindMethodByName(it->second.delta_grpc_); } -const Protobuf::MethodDescriptor& -sotwGrpcMethod(absl::string_view type_url, - envoy::config::core::v3::ApiVersion /*transport_api_version*/) { +const Protobuf::MethodDescriptor& sotwGrpcMethod(absl::string_view type_url) { const auto it = typeUrlToV3ServiceMap().find(static_cast(type_url)); ASSERT(it != typeUrlToV3ServiceMap().cend()); return *Protobuf::DescriptorPool::generated_pool()->FindMethodByName(it->second.sotw_grpc_); } -const Protobuf::MethodDescriptor& -restMethod(absl::string_view type_url, - envoy::config::core::v3::ApiVersion /*transport_api_version*/) { +const Protobuf::MethodDescriptor& restMethod(absl::string_view type_url) { const auto it = typeUrlToV3ServiceMap().find(static_cast(type_url)); ASSERT(it != typeUrlToV3ServiceMap().cend()); return *Protobuf::DescriptorPool::generated_pool()->FindMethodByName(it->second.rest_); diff --git a/source/common/config/type_to_endpoint.h b/source/common/config/type_to_endpoint.h index 7c9f5a500737..b600bf4e7d92 100644 --- a/source/common/config/type_to_endpoint.h +++ b/source/common/config/type_to_endpoint.h @@ -10,18 +10,12 @@ namespace Envoy { namespace Config { // Translates an xDS resource type_url to the name of the delta gRPC service that carries it. -const Protobuf::MethodDescriptor& -deltaGrpcMethod(absl::string_view resource_type_url, - envoy::config::core::v3::ApiVersion transport_api_version); +const Protobuf::MethodDescriptor& deltaGrpcMethod(absl::string_view resource_type_url); // Translates an xDS resource type_url to the name of the state-of-the-world gRPC service that // carries it. -const Protobuf::MethodDescriptor& -sotwGrpcMethod(absl::string_view resource_type_url, - envoy::config::core::v3::ApiVersion transport_api_version); +const Protobuf::MethodDescriptor& sotwGrpcMethod(absl::string_view resource_type_url); // Translates an xDS resource type_url to the name of the REST service that carries it. -const Protobuf::MethodDescriptor& -restMethod(absl::string_view resource_type_url, - envoy::config::core::v3::ApiVersion transport_api_version); +const Protobuf::MethodDescriptor& restMethod(absl::string_view resource_type_url); } // namespace Config } // namespace Envoy diff --git a/test/common/config/type_to_endpoint_test.cc b/test/common/config/type_to_endpoint_test.cc index 0a1d877bb613..4785f35f8b4c 100644 --- a/test/common/config/type_to_endpoint_test.cc +++ b/test/common/config/type_to_endpoint_test.cc @@ -20,34 +20,26 @@ TEST(TypeToEndpoint, All) { envoy::service::route::v3::RdsDummy _v3_rds_dummy; // Delta gRPC endpoints. - EXPECT_EQ("envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes", - deltaGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - envoy::config::core::v3::ApiVersion::AUTO) - .full_name()); - EXPECT_EQ("envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes", - deltaGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - envoy::config::core::v3::ApiVersion::V3) - .full_name()); + EXPECT_EQ( + "envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes", + deltaGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").full_name()); + EXPECT_EQ( + "envoy.service.route.v3.RouteDiscoveryService.DeltaRoutes", + deltaGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").full_name()); // SotW gRPC endpoints. - EXPECT_EQ("envoy.service.route.v3.RouteDiscoveryService.StreamRoutes", - sotwGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - envoy::config::core::v3::ApiVersion::AUTO) - .full_name()); - EXPECT_EQ("envoy.service.route.v3.RouteDiscoveryService.StreamRoutes", - sotwGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - envoy::config::core::v3::ApiVersion::V3) - .full_name()); + EXPECT_EQ( + "envoy.service.route.v3.RouteDiscoveryService.StreamRoutes", + sotwGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").full_name()); + EXPECT_EQ( + "envoy.service.route.v3.RouteDiscoveryService.StreamRoutes", + sotwGrpcMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").full_name()); // REST endpoints. EXPECT_EQ("envoy.service.route.v3.RouteDiscoveryService.FetchRoutes", - restMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - envoy::config::core::v3::ApiVersion::AUTO) - .full_name()); + restMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").full_name()); EXPECT_EQ("envoy.service.route.v3.RouteDiscoveryService.FetchRoutes", - restMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration", - envoy::config::core::v3::ApiVersion::V3) - .full_name()); + restMethod("type.googleapis.com/envoy.config.route.v3.RouteConfiguration").full_name()); } } // namespace