envoyproxy/gateway

Expose maxHosts for DynamicResolver DNS cache

开放

#9,382 创建于 2026年7月1日

 (3 条评论) (0 个反应) (0 位负责人)Go (802 个派生)auto 404
help wantedkind/enhancementkind/feature

仓库指标

星标
 (2,871 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Description:

We are using Envoy Gateway v1.8.1 with Backend type DynamicResolver.

In our environment, the generated Envoy Dynamic Forward Proxy DNS cache has reached the default Envoy max_hosts limit of 1024.

Metric:

envoy_dns_cache_envoy_gateway_dfp_cache_v4_preferred_30000ms_default_num_hosts

Envoy supports configuring this through DnsCacheConfig.max_hosts, but there does not appear to be a first-class Envoy Gateway API field to configure it through Backend, DynamicResolver, or EnvoyProxy.

We tried using EnvoyPatchPolicy to patch the generated Dynamic Forward Proxy clusters at:

/cluster_type/typed_config/dns_cache_config/max_hosts

However, multiple generated clusters share the same DNS cache name:

envoy-gateway-dfp-cache-v4_preferred-30000ms-default

Envoy requires every reference to the same DNS cache name to have identical settings. If any generated reference is missed, Envoy rejects the xDS update with:

config specified DNS cache 'envoy-gateway-dfp-cache-v4_preferred-30000ms-default' with different settings

This makes EnvoyPatchPolicy fragile for this use case because new DynamicResolver routes can create additional generated clusters that also need the same patch.

Expected behavior:

Envoy Gateway should expose a first-class way to configure Dynamic Forward Proxy DNS cache settings for DynamicResolver backends, especially maxHosts.

For example, as discussed with maintainers, this could be exposed through a field such as dns.maxHosts on ClusterSettings, or another API location that maintainers consider more appropriate.

The configured value should be wired into the generated Envoy DnsCacheConfig consistently for all generated resources sharing the same Dynamic Forward Proxy DNS cache.

[optional Relevant Links:] https://envoyproxy.slack.com/archives/C03E6NHLESV/p1782805661052069 Maintainer guidance from Slack: Envoy requires every reference to the same DNS cache name to carry identical settings, so partial EnvoyPatchPolicy patches can cause the "different settings" xDS rejection. A first-class API field such as dns.maxHosts on ClusterSettings may be the right fix.

贡献者指南