dns resolver: add options to initialize c-ares with custom timeout an… (#36947)

## Background

We recently saw a small number of DNS queries getting timed out. There
is currently no option for us to [initialize
c-ares](https://c-ares.org/ares_init_options.html) by passing in a
custom
[timeout](https://c-ares.org/ares_init_options.html#:~:text=c%2Dares%201.5.2.-,ARES_OPT_TIMEOUTMS,-int%20timeout%3B)
and
[tries](https://c-ares.org/ares_init_options.html#:~:text=c%2Dares%201.5.2.-,ARES_OPT_TRIES,-int%20tries%3B)
config options.

## Changes
In this PR, we are adding two new options in c-ares resolver for
configuring custom timeouts and tries while resolving DNS queries.
Custom timeouts could be configured by specifying
`query_timeout_seconds` option and custom tries could be configured by
specifying `query_tries` config option.

**Commit Message:** dns resolver: add options to initialize c-ares with
custom timeout and tries
**Additional Description:** add two new options called
`query_timeout_seconds` and `query_tries` for initializing c-ares with
custom timeout and tries.
**Risk Level:** Low
**Testing:** Added Unit/Integration Tests
**Docs Changes:** Added
**Release Notes:** Added
**Platform Specific Features:** N/A

---------

Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>

Mirrored from https://github.com/envoyproxy/envoy @ 0a2e904c7f1b8232e5e9700f2d995a76f4c84014
main
update-envoy[bot] 3 weeks ago
parent e143288608
commit cbb7b6e3fb
  1. 16
      envoy/extensions/network/dns_resolver/cares/v3/cares_dns_resolver.proto

@ -8,6 +8,7 @@ import "envoy/config/core/v3/resolver.proto";
import "google/protobuf/wrappers.proto"; import "google/protobuf/wrappers.proto";
import "udpa/annotations/status.proto"; import "udpa/annotations/status.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.network.dns_resolver.cares.v3"; option java_package = "io.envoyproxy.envoy.extensions.network.dns_resolver.cares.v3";
option java_outer_classname = "CaresDnsResolverProto"; option java_outer_classname = "CaresDnsResolverProto";
@ -19,7 +20,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#extension: envoy.network.dns_resolver.cares] // [#extension: envoy.network.dns_resolver.cares]
// Configuration for c-ares DNS resolver. // Configuration for c-ares DNS resolver.
// [#next-free-field: 6] // [#next-free-field: 8]
message CaresDnsResolverConfig { message CaresDnsResolverConfig {
// A list of dns resolver addresses. // A list of dns resolver addresses.
// :ref:`use_resolvers_as_fallback<envoy_v3_api_field_extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig.use_resolvers_as_fallback>` // :ref:`use_resolvers_as_fallback<envoy_v3_api_field_extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig.use_resolvers_as_fallback>`
@ -47,4 +48,17 @@ message CaresDnsResolverConfig {
// This option allows for number of UDP based DNS queries to be capped. Note, this // This option allows for number of UDP based DNS queries to be capped. Note, this
// is only applicable to c-ares DNS resolver currently. // is only applicable to c-ares DNS resolver currently.
google.protobuf.UInt32Value udp_max_queries = 5; google.protobuf.UInt32Value udp_max_queries = 5;
// The number of seconds each name server is given to respond to a query on the first try of any given server.
//
// Note: While the c-ares library defaults to 2 seconds, Envoy's default (if this field is unset) is 5 seconds.
// This adjustment was made to maintain the previous behavior after users reported an increase in DNS resolution times.
google.protobuf.UInt64Value query_timeout_seconds = 6 [(validate.rules).uint64 = {gte: 1}];
// The maximum number of query attempts the resolver will make before giving up.
// Each attempt may use a different name server.
//
// Note: While the c-ares library defaults to 3 attempts, Envoy's default (if this field is unset) is 4 attempts.
// This adjustment was made to maintain the previous behavior after users reported an increase in DNS resolution times.
google.protobuf.UInt32Value query_tries = 7 [(validate.rules).uint32 = {gte: 1}];
} }

Loading…
Cancel
Save