Skip to content

Move the owner-name rule into its own package - #198

Merged
vvoytovych merged 1 commit into
mainfrom
refactor/owner-name-rule-package
Sep 29, 2026
Merged

vvoytovych merged 1 commit into
mainfrom
refactor/owner-name-rule-package

Conversation

@vvoytovych

@vvoytovych vvoytovych commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The rule that decides whether two spellings of an owner name are one name lived inside the PowerDNS client, so the webhook and the status helpers imported the backend to use it, and the helpers kept a second copy. This moves the rule into a small package of its own, and the helpers now call it. Nothing changes in behaviour. It prepares the fix for #188, whose election of claimants must not depend on the backend.

Test plan

  • Unit, envtest and PowerDNS integration tests pass, and lint is clean
  • The status helpers give the same answer as before on every owner and zone pair tried, malformed ones included
  • The CLI and the MCP server build and pass their tests

The rule that turns an owner name into the absolute name PowerDNS keys an
RRset on lived in the PowerDNS client, so every package that compared owner
names imported the backend, and the status helpers kept a copy of their
own. It now lives in internal/dns/ownername, which imports nothing from the
operator, and the helpers call it. They still accept a name typed without a
zone.

No behaviour changes. The fix for #188 needs this: its election of claimants
must not depend on the backend.
@vvoytovych
vvoytovych marked this pull request as ready for review September 29, 2026 08:07
@vvoytovych
vvoytovych requested a review from a team as a code owner September 29, 2026 08:07
@vvoytovych
vvoytovych merged commit 9c2496c into main Sep 29, 2026
12 checks passed
@vvoytovych
vvoytovych deleted the refactor/owner-name-rule-package branch September 29, 2026 11:15
@0xmc

0xmc commented Sep 29, 2026

Copy link
Copy Markdown

@vvoytovych you state "Nothing changes in behaviour," but it looks like ownername now comes from milo instead of powerdns, which is an improvement. Is it because the owername strings are equal in all cases?

@vvoytovych

Copy link
Copy Markdown
Contributor Author

@0xmc Yes, the strings are equal in every case, because the code is the same. go.miloapis.com/dns-operator is this repository's module path, not Milo. The owner name still comes from the record set's spec and its zone's domain, as before. Neither Milo nor PowerDNS is asked.

  • ownername.Qualify is pdns.QualifyOwner moved as it was. The function body is byte for byte the same.
  • The status helpers, which the CLI and the MCP server use for names people type, had a copy of their own. They now call ownername.Qualify when a zone is given, and they still trim spaces and accept a name without a zone. Against their old version they gave the same answer on 436,956 owner and zone pairs, malformed ones included, with no difference.

The reason for the move: code that compares owner names no longer has to import the PowerDNS client. The shared election function (step 3 of #201) needs that.

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.

3 participants