Skip to content

fix: preserve prefer_udp in LocalDNS Corefile - #9164

Open
Saewon Kwak (saewoni) wants to merge 1 commit into
mainfrom
sakwa/prefer-udp-corefile
Open

fix: preserve prefer_udp in LocalDNS Corefile#9164
Saewon Kwak (saewoni) wants to merge 1 commit into
mainfrom
sakwa/prefer-udp-corefile

Conversation

@saewoni

@saewoni Saewon Kwak (saewoni) commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Change summary

Preserves CoreDNS prefer_udp behavior when LocalDNS overrides specify Protocol: PreferUDP.

  • Updates the aks-node-controller LocalDNS Corefile template to render prefer_udp in forward blocks when the override protocol is PreferUDP.
  • Updates the legacy pkg/agent LocalDNS Corefile renderer with the same prefer_udp handling so scriptless and non-scriptless render paths stay consistent.
  • Keeps existing force_tcp behavior intact for Protocol: ForceTCP.
  • Updates LocalDNS Corefile golden/assertion coverage so PreferUDP is emitted for both render paths.

This fixes a mismatch where LocalDNS override data could carry Protocol: PreferUDP, but the generated Corefile did not preserve that setting.

Testing

Emit the CoreDNS prefer_udp directive whenever LocalDNS overrides request Protocol: PreferUDP in both scriptless and non-scriptless Corefile render paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ensures the LocalDNS CoreDNS “forward” plugin option prefer_udp is preserved when LocalDNS overrides specify Protocol: PreferUDP, across both the non-scriptless (pkg/agent) and scriptless (aks-node-controller) Corefile render paths.

Changes:

  • Update pkg/agent LocalDNS Corefile template to emit prefer_udp when override.Protocol == "PreferUDP".
  • Update aks-node-controller LocalDNS template to emit prefer_udp for the same override protocol.
  • Refresh golden/expected Corefile outputs and assertions in unit tests to include prefer_udp.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
pkg/agent/baker.go Emit prefer_udp in LocalDNS Corefile rendering when overrides request PreferUDP.
pkg/agent/baker_test.go Update expected Corefile strings/assertions so PreferUDP output includes prefer_udp.
aks-node-controller/parser/templates/localdns.toml.gtpl Emit prefer_udp in the scriptless LocalDNS Corefile template for PreferUDP overrides.
aks-node-controller/parser/helper_test.go Update expected Corefile strings to include prefer_udp for PreferUDP test cases.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Windows Unit Test Results

  3 files   12 suites   1m 4s ⏱️
389 tests 389 ✅ 0 💤 0 ❌
392 runs  392 ✅ 0 💤 0 ❌

Results for commit aefb861.

@saewoni Saewon Kwak (saewoni) changed the title Preserve prefer_udp in LocalDNS Corefile fix: preserve prefer_udp in LocalDNS Corefile Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants