← Back to Pull requests

feat: expose maxHosts for DynamicResolver DNS cache #9740

Open
unknown opened this pull request with 274 lines diff across 3 files
View on GitHub
unknown unknown commented on Aug 13, 2026 05:18 UTC
Author

Fixes #9382

What this does

Envoy's dynamic_forward_proxy DnsCacheConfig supports a max_hosts field that bounds how many hosts the DNS cache holds. Envoy Gateway did not expose it, so it was pinned to Envoy's default of 1024. This adds a first-class maxHosts field to the DNS configuration.

Design

The field is added to the shared DNS type, so it is configurable everywhere existing DNS settings live (BackendTrafficPolicy, EnvoyExtensionPolicy, EnvoyProxy, SecurityPolicy) — consistent with how dnsRefreshRate and lookupFamily are already surfaced. It flows through the standard pipeline:

  • API — api/v1alpha1/dns_types.go: MaxHosts uint32 (+kubebuilder:validation:Minimum=1)

  • IR — internal/ir/xds.go: MaxHosts uint32 on the internal DNS struct

  • API → IR — internal/gatewayapi/clustersettings.go (translateDNS)

  • IR → xDS — internal/xds/translator/cluster.go (buildDFPDNSCacheConfig), which feeds both the cluster and SNI dynamic-forward-proxy paths
  • When unset, Envoy's default is preserved.

    The issue floated Backend / DynamicResolver / EnvoyProxy as candidate homes for the field; putting it on the shared DNS type covers those via the existing ClusterSettings.dns surface. Happy to move it if maintainers prefer a narrower placement.

    Testing

    Generated code (deepcopy, CRDs, API reference docs) was regenerated with the repo's own tooling (controller-gen, crd-ref-docs).

  • New xDS translator golden case http-route-dynamic-resolver-dns-max-hosts asserting maxHosts in the rendered Envoy dnsCacheConfig

  • Extended the gatewayapi backendtrafficpolicy-with-dns-settings fixture to exercise the API→IR conversion

  • New TestBuildDFPDNSCacheConfig unit test covering nil / unset / set
  • go test ./internal/xds/translator/ ./internal/gatewayapi/ ./internal/ir/ ./api/...
    go vet ./internal/xds/translator/ ./internal/gatewayapi/ ./internal/ir/ ./api/...
    

    ---

    This PR was authored with the assistance of Claude, an AI assistant.

    🤖 Generated with Claude Code

    Diff: 274 lines (+205 / -69) across 3 files Reviewer: vishals-3 Review duration: 71198m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.47) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 274 lines diff across 3 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.336
    Real PR Conversation Timeline
    1 comments
    "Review active on #9740"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 40.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 46.5% (MEDIUM) · Higher = larger blast radius
    46.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.5% · Safe to merge
    27.5%