fix(rfc2136): normalize CNAME trailing dots to stop sync churn#6555
fix(rfc2136): normalize CNAME trailing dots to stop sync churn#6555dpacgdm wants to merge 1 commit into
Conversation
DNSEndpoint CRDs and rfc2136 AXFR merge paths disagreed on trailing-dot FQDN form for CNAME/NS/PTR targets, so every sync deleted and recreated identical records. Normalize at CRD ingest, Targets.Same, and AXFR merge. Signed-off-by: dpacgdm <dpac.gdm@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @dpacgdm. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Share setup for kubernetes to reproduce it pls |
|
@ivankatliarchuk Sure — minimal setup to reproduce (same shape as #6199): Prereqs
Minimal Deployment args DNSEndpoint apiVersion: externaldns.k8s.io/v1alpha1
kind: DNSEndpoint
metadata:
name: myservice
spec:
endpoints:
- dnsName: myservice.example.com
recordTTL: 3600
recordType: CNAME
targets:
- traefik.example.comWhat to look for (pre-fix) On each sync, debug logs show identical CNAME + TXT ownership RRs being removed and re-added, e.g.: Cause: AXFR returns the CNAME target with a trailing dot ( Full reporter setup + sanitised logs: #6199 I validated the mismatch/fix path with unit tests in this PR ( |
|
But how is your rfc2136 looks like? |
|
The reason I'm asking, I have a bind setup for rfc2136 and not observing that issue. Seems like something related to https://technitium.com/dns/ |
|
@ivankatliarchuk Good question — I don't run a live RFC2136 server myself. I reproduced the mismatch via unit/plan tests and traced it from the reporter's setup in #6199, where the backend is Technitium DNS. Their AXFR logs show the CNAME target coming back with a trailing dot ( If your BIND setup returns or normalizes CNAME targets differently on AXFR, you may not see the churn — that would actually support treating this as a normalization gap rather than something every RFC2136 backend triggers. The fix still hardens comparison so CRD-sourced CNAME/NS/PTR targets match regardless of trailing-dot form in the AXFR response. If you're up for a quick check: a DNSEndpoint CNAME (target without trailing dot) plus debug logs of the AXFR |
Summary
NewEndpointWithTTLso CNAME/NS/PTR targets match Ingress/Service (trailing dots stripped).Targets.Sameto ignore trailing dots when comparing FQDN targets, preventing plan churn when current (AXFR) and desired (CRD) forms differ.NewEndpointWithTTLso multi-RR names get the same normalization as the first RR.Fixes asymmetric trailing-dot handling that caused RFC2136 CNAME records from DNSEndpoint CRDs (and their TXT ownership records) to be removed and re-added every sync cycle.
Related: #6199
Test plan
go test ./endpoint/ -run 'TestSame|TestTargetsSame|TestNewEndpointWithTTL'go test ./plan/ -run TestPlanNoChurnCNAMETrailingDotgo test ./provider/rfc2136/ -run 'TestRfc2136RecordsNormalizesCNAMETrailingDot|TestRfc2136GetRecords'go test ./source/ -run 'TestCRDSourceNormalizesCNAMETrailingDot|TestCRDSource'--provider=rfc2136 --rfc2136-tsig-axfr --source=crdand a DNSEndpoint CNAME; confirm subsequent syncs make no remove/add for unchanged recordsMade with Cursor