Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions source/extensions/filters/http/ext_authz/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ Http::FilterFactoryCb ExtAuthzFilterConfig::createFilterFactoryFromProtoTyped(
} else if (proto_config.grpc_service().has_google_grpc()) {
// Google gRPC client.

// The use_alpha field was there select the v2alpha api version, which is
// long deprecated and should not be used anymore.
if (proto_config.hidden_envoy_deprecated_use_alpha()) {
throw EnvoyException("The use_alpha field is deprecated and is no longer supported.");
}

const uint32_t timeout_ms =
PROTOBUF_GET_MS_OR_DEFAULT(proto_config.grpc_service(), timeout, DefaultTimeout);

Expand All @@ -64,11 +58,6 @@ Http::FilterFactoryCb ExtAuthzFilterConfig::createFilterFactoryFromProtoTyped(
} else {
// Envoy gRPC client.

// The use_alpha field was there select the v2alpha api version, which is
// long deprecated and should not be used anymore.
if (proto_config.hidden_envoy_deprecated_use_alpha()) {
throw EnvoyException("The use_alpha field is deprecated and is no longer supported.");
}
Grpc::RawAsyncClientSharedPtr raw_client =
context.clusterManager().grpcAsyncClientManager().getOrCreateRawAsyncClient(
proto_config.grpc_service(), context.scope(), true, Grpc::CacheOption::AlwaysCache);
Expand Down
50 changes: 0 additions & 50 deletions test/extensions/filters/http/ext_authz/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,56 +131,6 @@ TEST(HttpExtAuthzConfigTest, CorrectProtoHttp) {
cb(filter_callback);
}

// Test that setting the use_alpha proto field throws.
TEST(HttpExtAuthzConfigTest, DEPRECATED_FEATURE_TEST(UseAlphaFieldIsNoLongerSupported)) {
TestScopedRuntime scoped_runtime;
Runtime::LoaderSingleton::getExisting()->mergeValues(
{{"envoy.deprecated_features:envoy.extensions.filters.http.ext_authz.v3.ExtAuthz.hidden_"
"envoy_deprecated_use_alpha",
"true"}});

envoy::extensions::filters::http::ext_authz::v3::ExtAuthz proto_config;
proto_config.set_hidden_envoy_deprecated_use_alpha(true);

// Trigger the throw in the Envoy gRPC branch.
{
testing::StrictMock<Server::Configuration::MockFactoryContext> context;
testing::StrictMock<Server::Configuration::MockServerFactoryContext> server_context;
EXPECT_CALL(context, getServerFactoryContext())
.WillRepeatedly(testing::ReturnRef(server_context));
EXPECT_CALL(context, messageValidationVisitor());
EXPECT_CALL(context, runtime());
EXPECT_CALL(context, scope());

ExtAuthzFilterConfig factory;
EXPECT_THROW_WITH_MESSAGE(factory.createFilterFactoryFromProto(proto_config, "stats", context),
EnvoyException,
"The use_alpha field is deprecated and is no longer supported.")
}

// Trigger the throw in the Google gRPC branch.
{
auto google_grpc = new envoy::config::core::v3::GrpcService_GoogleGrpc();
google_grpc->set_stat_prefix("grpc");
google_grpc->set_target_uri("http://example.com");
proto_config.set_transport_api_version(envoy::config::core::v3::ApiVersion::V3);
proto_config.mutable_grpc_service()->set_allocated_google_grpc(google_grpc);

testing::StrictMock<Server::Configuration::MockFactoryContext> context;
testing::StrictMock<Server::Configuration::MockServerFactoryContext> server_context;
EXPECT_CALL(context, getServerFactoryContext())
.WillRepeatedly(testing::ReturnRef(server_context));
EXPECT_CALL(context, messageValidationVisitor());
EXPECT_CALL(context, runtime());
EXPECT_CALL(context, scope());

ExtAuthzFilterConfig factory;
EXPECT_THROW_WITH_MESSAGE(factory.createFilterFactoryFromProto(proto_config, "stats", context),
EnvoyException,
"The use_alpha field is deprecated and is no longer supported.")
}
}

// Test that the deprecated extension name still functions.
TEST(HttpExtAuthzConfigTest, DEPRECATED_FEATURE_TEST(DeprecatedExtensionFilterName)) {
const std::string deprecated_name = "envoy.ext_authz";
Expand Down
4 changes: 2 additions & 2 deletions test/integration/hds_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class HdsIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest,
EXPECT_EQ("POST", hds_stream_->headers().getMethodValue());
EXPECT_EQ(TestUtility::getVersionedMethodPath("envoy.service.{1}.{0}.HealthDiscoveryService",
"StreamHealthCheck", apiVersion(),
/*use_alpha=*/false, serviceNamespace()),
serviceNamespace()),
hds_stream_->headers().getPathValue());
EXPECT_EQ("application/grpc", hds_stream_->headers().getContentTypeValue());
}
Expand Down Expand Up @@ -335,7 +335,7 @@ class HdsIntegrationTest : public Grpc::VersionedGrpcClientIntegrationParamTest,
EXPECT_EQ("POST", hds_stream_->headers().getMethodValue());
EXPECT_EQ(TestUtility::getVersionedMethodPath("envoy.service.{1}.{0}.HealthDiscoveryService",
"StreamHealthCheck", apiVersion(),
/*use_alpha=*/false, serviceNamespace()),
serviceNamespace()),
hds_stream_->headers().getPathValue());
EXPECT_EQ("application/grpc", hds_stream_->headers().getContentTypeValue());
}
Expand Down
15 changes: 5 additions & 10 deletions test/test_common/utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,21 +782,18 @@ class TestUtility {
*
* @param service_full_name_template the service fully-qualified name template.
* @param api_version version of a service.
* @param use_alpha if the alpha version is preferred.
* @param service_namespace to override the service namespace.
* @return std::string full path of a service method.
*/
static std::string
getVersionedServiceFullName(const std::string& service_full_name_template,
envoy::config::core::v3::ApiVersion api_version,
bool use_alpha = false,
const std::string& service_namespace = EMPTY_STRING) {
switch (api_version) {
case envoy::config::core::v3::ApiVersion::AUTO:
FALLTHRU;
case envoy::config::core::v3::ApiVersion::V2:
return fmt::format(service_full_name_template, use_alpha ? "v2alpha" : "v2",
service_namespace);
return fmt::format(service_full_name_template, "v2", service_namespace);

case envoy::config::core::v3::ApiVersion::V3:
return fmt::format(service_full_name_template, "v3", service_namespace);
Expand All @@ -811,19 +808,17 @@ class TestUtility {
* @param service_full_name_template the service fully-qualified name template.
* @param method_name the method name.
* @param api_version version of a service method.
* @param use_alpha if the alpha version is preferred.
* @param service_namespace to override the service namespace.
* @return std::string full path of a service method.
*/
static std::string getVersionedMethodPath(const std::string& service_full_name_template,
absl::string_view method_name,
envoy::config::core::v3::ApiVersion api_version,
bool use_alpha = false,
const std::string& service_namespace = EMPTY_STRING) {
return absl::StrCat("/",
getVersionedServiceFullName(service_full_name_template, api_version,
use_alpha, service_namespace),
"/", method_name);
return absl::StrCat(
"/",
getVersionedServiceFullName(service_full_name_template, api_version, service_namespace),
"/", method_name);
}
};

Expand Down