Skip to content
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

Put dns_resolution_config field in dns_filter.proto as deprecated #18649

Merged
merged 4 commits into from
Oct 22, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ message DnsFilterConfig {
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

// DNS resolution configuration which includes the underlying dns resolver addresses and options.
// This field will be deprecated in favor of
// This field is deprecated in favor of
// :ref:`typed_dns_resolver_config <envoy_v3_api_field_extensions.filters.udp.dns_filter.v3.DnsFilterConfig.ClientContextConfig.typed_dns_resolver_config>`.
config.core.v3.DnsResolutionConfig dns_resolution_config = 5;
config.core.v3.DnsResolutionConfig dns_resolution_config = 5
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

// DNS resolver type configuration extension. This extension can be used to configure c-ares, apple,
// or any other DNS resolver types and the related parameters.
Expand Down
1 change: 1 addition & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ Deprecated
* bootstrap: :ref:`dns_resolution_config <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.dns_resolution_config>` is deprecated in favor of :ref:`typed_dns_resolver_config <envoy_v3_api_field_config.bootstrap.v3.Bootstrap.typed_dns_resolver_config>`.
* cluster: :ref:`dns_resolution_config <envoy_v3_api_field_config.cluster.v3.Cluster.dns_resolution_config>` is deprecated in favor of :ref:`typed_dns_resolver_config <envoy_v3_api_field_config.cluster.v3.Cluster.typed_dns_resolver_config>`.
* dns_cache: :ref:`dns_resolution_config <envoy_v3_api_field_extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.dns_resolution_config>` is deprecated in favor of :ref:`typed_dns_resolver_config <envoy_v3_api_field_extensions.common.dynamic_forward_proxy.v3.DnsCacheConfig.typed_dns_resolver_config>`.
* dns_filter: :ref:`dns_resolution_config <envoy_v3_api_field_extensions.filters.udp.dns_filter.v3.DnsFilterConfig.ClientContextConfig.dns_resolution_config>` is deprecated in favor of :ref:`typed_dns_resolver_config <envoy_v3_api_field_extensions.filters.udp.dns_filter.v3.DnsFilterConfig.ClientContextConfig.typed_dns_resolver_config>`.
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ name: listener_0
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
dns_resolution_config:
resolvers:
- socket_address:
address: {}
port_value: {}
dns_resolver_options:
use_tcp_for_dns_lookups: false
no_default_search_domain: false
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socket_address:
address: {}
port_value: {}
dns_resolver_options:
use_tcp_for_dns_lookups: false
no_default_search_domain: false
max_pending_lookups: 256
server_config:
inline_dns_table:
Expand Down
139 changes: 94 additions & 45 deletions test/extensions/filters/udp/dns_filter/dns_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,20 @@ stat_prefix: "my_prefix"
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
dns_resolution_config:
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
- socket_address:
address: "8.8.8.8"
port_value: 53
- socket_address:
address: "8.8.4.4"
port_value: 53
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
- socket_address:
address: "8.8.8.8"
port_value: 53
- socket_address:
address: "8.8.4.4"
port_value: 53
max_pending_lookups: 1
server_config:
inline_dns_table:
Expand All @@ -216,11 +219,14 @@ stat_prefix: "my_prefix"
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
dns_resolution_config:
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
max_pending_lookups: 256
server_config:
external_dns_table:
Expand All @@ -231,11 +237,14 @@ stat_prefix: "my_prefix"
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
dns_resolution_config:
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
max_pending_lookups: 256
server_config:
external_dns_table:
Expand All @@ -246,14 +255,17 @@ stat_prefix: "my_prefix"
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
dns_resolution_config:
dns_resolver_options:
use_tcp_for_dns_lookups: false
no_default_search_domain: false
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
dns_resolver_options:
use_tcp_for_dns_lookups: false
no_default_search_domain: false
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
max_pending_lookups: 256
server_config:
external_dns_table:
Expand All @@ -264,14 +276,17 @@ stat_prefix: "my_prefix"
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
dns_resolution_config:
dns_resolver_options:
use_tcp_for_dns_lookups: true
no_default_search_domain: true
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
dns_resolver_options:
use_tcp_for_dns_lookups: true
no_default_search_domain: true
resolvers:
- socket_address:
address: "1.1.1.1"
port_value: 53
max_pending_lookups: 256
server_config:
external_dns_table:
Expand Down Expand Up @@ -2154,7 +2169,7 @@ TEST_F(DnsFilterTest, DnsResolverOptionsSetFalse) {
EXPECT_EQ(false, dns_resolver_options_.no_default_search_domain());
}

TEST_F(DnsFilterTest, DnsResolutionConfigExist) {
yanjunxiang-google marked this conversation as resolved.
Show resolved Hide resolved
TEST_F(DnsFilterTest, DEPRECATED_FEATURE_TEST(DnsResolutionConfigExist)) {
const std::string dns_resolution_config_exist = R"EOF(
stat_prefix: "my_prefix"
client_config:
Expand All @@ -2180,9 +2195,7 @@ stat_prefix: "my_prefix"
std::string config_to_use = fmt::format(dns_resolution_config_exist, temp_path);
setup(config_to_use);

// `true` here means use_tcp_for_dns_lookups is set true
yanjunxiang-google marked this conversation as resolved.
Show resolved Hide resolved
EXPECT_EQ(false, dns_resolver_options_.use_tcp_for_dns_lookups());
// `true` here means no_default_search_domain is set true
EXPECT_EQ(false, dns_resolver_options_.no_default_search_domain());

// address matches
Expand All @@ -2194,7 +2207,7 @@ stat_prefix: "my_prefix"
}

// test typed_dns_resolver_config exits which overrides dns_resolution_config.
TEST_F(DnsFilterTest, TypedDnsResolverConfigExist) {
TEST_F(DnsFilterTest, DEPRECATED_FEATURE_TEST(TypedDnsResolverConfigOverrideDnsResolutionConfig)) {
const std::string typed_dns_resolver_config_exist = R"EOF(
stat_prefix: "my_prefix"
client_config:
Expand Down Expand Up @@ -2231,9 +2244,47 @@ stat_prefix: "my_prefix"
std::string config_to_use = fmt::format(typed_dns_resolver_config_exist, temp_path);
setup(config_to_use);

// `true` here means use_tcp_for_dns_lookups is set true
EXPECT_EQ(true, dns_resolver_options_.use_tcp_for_dns_lookups());
// `true` here means no_default_search_domain is set true
EXPECT_EQ(true, dns_resolver_options_.no_default_search_domain());

// address matches
auto resolvers = envoy::config::core::v3::Address();
resolvers.mutable_socket_address()->set_address("1.2.3.4");
resolvers.mutable_socket_address()->set_port_value(80);
EXPECT_EQ(true, TestUtility::protoEqual(cares_.resolvers(0), resolvers));
}

// test typed_dns_resolver_config exits.
TEST_F(DnsFilterTest, TypedDnsResolverConfigExist) {
yanjunxiang-google marked this conversation as resolved.
Show resolved Hide resolved
const std::string typed_dns_resolver_config_exist = R"EOF(
stat_prefix: "my_prefix"
client_config:
resolver_timeout: 1s
typed_dns_resolver_config:
name: envoy.network.dns_resolver.cares
typed_config:
"@type": type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socket_address:
address: "1.2.3.4"
port_value: 80
dns_resolver_options:
use_tcp_for_dns_lookups: true
no_default_search_domain: true
max_pending_lookups: 256
server_config:
external_dns_table:
filename: {}
)EOF";

InSequence s;

std::string temp_path =
TestEnvironment::writeStringToFileForTest("dns_table.yaml", max_records_table_yaml);
std::string config_to_use = fmt::format(typed_dns_resolver_config_exist, temp_path);
setup(config_to_use);

EXPECT_EQ(true, dns_resolver_options_.use_tcp_for_dns_lookups());
EXPECT_EQ(true, dns_resolver_options_.no_default_search_domain());

// address matches
Expand Down Expand Up @@ -2262,9 +2313,7 @@ stat_prefix: "my_prefix"
std::string config_to_use = fmt::format(no_dns_config_exist, temp_path);
setup(config_to_use);

// `true` here means use_tcp_for_dns_lookups is set true
EXPECT_EQ(false, dns_resolver_options_.use_tcp_for_dns_lookups());
// `true` here means no_default_search_domain is set true
EXPECT_EQ(false, dns_resolver_options_.no_default_search_domain());

// No address
Expand Down