Skip to content

fix(registry/crd): skip DNSRecord writes in dry-run - #6935

Open
dominikhei wants to merge 2 commits into
kubernetes-sigs:masterfrom
dominikhei:crd-registry-dry-run
Open

dominikhei wants to merge 2 commits into
kubernetes-sigs:masterfrom
dominikhei:crd-registry-dry-run

Conversation

@dominikhei

@dominikhei dominikhei commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What does it do ?

Makes the CRD registry (--registry=crd) respect --dry-run. In dry-run mode, ApplyChanges now logs the DNSRecord writes it would make and only passes the changes on to the provider, which handles dry-run itself.

Part of #6932

Motivation

Dry-run is only handled inside the providers. The CRD registry writes its ownership DNSRecord objects itself, so in dry-run it still created, updated and deleted them and marked them Programmed, while the DNS records stayed untouched. external-dns then treated those records as applied, so after turning dry-run off they were never created in DNS. This is the same problem as the DynamoDB registry in #6932.

End-to-end check against BIND in kind (--provider=rfc2136 --registry=crd --dry-run, DNSEndpoint for dry.example.test A 1.2.3.4):

master

first dry-run:   Adding RR: dry.example.test 300 A 1.2.3.4
DNS (dig A):     (no record)
DNSRecord:       dry-example-test-264be59c  dry.example.test  Ready=True (Programmed)
second dry-run:  All records are already up to date

this branch

first dry-run:   Dry run mode, skipping DNSRecord create default/dry-example-test-264be59c (dry.example.test A)
                 Adding RR: dry.example.test 300 A 1.2.3.4
DNS (dig A):     (no record)
DNSRecord:       (none)
second dry-run:  same as the first, the create is still planned

A normal sync without --dry-run afterwards creates both the DNS record (1.2.3.4) and a Programmed DNSRecord, as before.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vflaux for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the registry Issues or PRs related to a registry label Nov 6, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from Raffo and u-kai November 6, 2026 13:32
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 6, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @dominikhei. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@kubernetes-prow kubernetes-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Nov 6, 2026
@mloiseleur

Copy link
Copy Markdown
Collaborator

PR title is used for the merged commit & the changelog.
@dominikhei Would you please follow the semantic commit convention for the PR title? and keep it as short as possible?

@dominikhei dominikhei changed the title skip DNSRecord writes in dry-run so the CRD registry stays in sync wi… fix(registry/crd): skip DNSRecord writes in dry-run Nov 6, 2026
@mloiseleur

Copy link
Copy Markdown
Collaborator

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 6, 2026
@coveralls

coveralls commented Nov 6, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 42289466005

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.05%) to 83.449%

Details

  • Coverage increased (+0.05%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 89 coverage regressions across 4 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

89 previously-covered lines in 4 files lost coverage.

File Lines Losing Coverage Coverage
rfc2136/rfc2136.go 63 81.84%
crd/crd.go 22 89.33%
utils.go 3 97.39%
openshift_route.go 1 87.27%

Coverage Stats

Coverage Status
Relevant Lines: 19818
Covered Lines: 16538
Line Coverage: 83.45%
Coverage Strength: 1466.93 hits per line

💛 - Coveralls

@dominikhei

Copy link
Copy Markdown
Contributor Author

@mloiseleur the docs for the web hook provider don't clearly specify that it skips the dry-run flag. Shall we mention this expclicitly to not lead to any confusion in the future.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. registry Issues or PRs related to a registry size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants