Feat/rework dnszone reconcile loop - #82
Conversation
…ments. wip(): unified interfaces for zone and recordset management Filters which DNSZone and DNSRecordSet resources to act on. Unifies DNS controller implementation with defined interfaces to support multiple API enpdpoint types in the future (e.g. powerdns, hickory)
feat(): change default class name to match current infra deployment for backward compatibility.
… Interfaces DNS controllers
…den cleanup Unify DNSRecordSet handling under a single reconciler, add restart-safe finalizer cleanup, persist owner/generation metadata in PowerDNS, and update docs and tests for the new flow.
|
these must be cleaned before this merges #83 |
|
tomáš (@fr6nco) wrote a summary separately:
|
…ation and fix typo in DNSZone message. fix(pdns): improved error handling on deletion
|
PR #82 closes half of #58. The finalizer now waits on a successful downstream delete. It makes #59 worse: workers drop from 4 to 1, per-reconcile PowerDNS calls rise from 1 to M+1 plus a cross-zone search, and the fan-out win it is built on is worth 1.6%, because production averages 1.02 record names per record set. Two correctness bugs outrank both issues. The error branch reports Green CI proves nothing here. Four headline mechanisms can be deleted wholesale and the suite still passes, because the fake stubs Don't merge. |
|
Issues this branch touches, and where each stands against it:
Upstream, both of these measure a record set condition rather than a resolvable name, so they would report success on this branch whether or not the record reaches PowerDNS: |
|
Rewritten against Closed by c7e7787
Blockers still open
The zone fetch at Majors
Throughput, measuredOver 7 days in production,
The before-model reproduces #59's observed p95 of 78.8 s, which is what makes the projection credible. Separately, What the green CI provesFour mechanisms were deleted or disabled one at a time in a scratch copy. The suite stayed green on all four.
Worth keeping: finalizer-before-programming ordering, the non-controller ownerReference, RefutedChecked and found not to be problems:
Residue
Measured baseline
p99 Reconcile error ratios track within 0.4 points between environments on every controller, and both clusters are looping identically on Two facts that bear on the stranded-finalizer finding: every one of the 4,254 DNSZone and DNSRecordSet objects across both clusters carries the downstream finalizer, so every delete must traverse that path. And five production record sets plus three in staging currently reference DNSZones that do not exist, sitting with no Note on evidenceThe two commits on top of #79 have never run in any environment. Staging serves So the failure modes above are inferred from the code, not observed. What is measured: the object counts, the six duplicate keys, the concurrency settings, the queue and error metrics, and the universal finalizer coverage. Production currently holds 115 DNSZones and 2,707 DNSRecordSets; staging holds 38 and 1,394. No object is in Terminating in either cluster right now, and no status anywhere carries a One check remains unrun and would settle the comment-shape question independently of the fix in |
|
i think my claudes inferred a lot here and didnt test it |
|
filing followups for observation/confirmation |
ecv
left a comment
There was a problem hiding this comment.
Approving. The findings in my earlier comment are accepted risk, not resolved, and the two that fire on upgrade rather than at some later edge are worth restating here.
The error branch in EnsureRecordSet builds its status with ConditionTrue, so a PowerDNS read failure reports the record as programmed. And the fast path tests zones[0].Comments == nil, which never matches, because PowerDNS emits "comments": [] and Go decodes that to a non-nil empty slice. Every record set written before this change carries no comments, so all of them take the skip branch and stay there, including after a later spec edit.
Both are small changes. Passing ConditionFalse at the two error call sites, and defaulting needsReplace to true unless an OBSERVED_GENERATION comment matches, close them without touching the design.
Nothing here destroys data. The desired state stays in the specs and PowerDNS holds the actual state, so any orphan or stale record is recoverable by diffing the two. What is missing is anything that runs that diff: there is no sweeper in the binary and no DNS alert rule in production, so residue persists until someone looks.
Yes this is an issue. Will be updated to ConditionFalse.
unfortunately this is left like this on purpose, as adding all the RRSets is happening in a loop. We don't want other requests to fail if one of the requests failed. It also happens on delete, so it remains orphaned until the next reconcile loop, where orphaned resources are cleaned up.
I have to take a second look on this
infortunately intentional. Mentioned in my comments, that we need the zoneClass information to delete the zone.
class rename should not be allowed. so intentional. Yes if a class is gone, we stuck the system. We do not reconcile on dnsclasses, but we dont touch them either, so should be fine. Eventually we can set finalizers and immutable fields to be sure. but for the current status this is ok
perhaps we should not delete out of zone? we should not delete zone via API outside of the controller, so I think this is fine.
this was fixed in an update yesterday evening
this was fixed in an update yesterday evening
Agreed, in next development cycle we should make these fields immutable.
Aware, we have to use a backend where comments or other metadata is supported. which we do.
there's already one
validating webhook should be added, so no duplicates can be in the system. This will solve way too many problems in the future.
to be fixed manually
probably a use case which should never happen, but will be addressed in the update.
this need to be tested, I dont think the numbers will be that dramatic. I can run the reconciler with the fake client, without writes against staging/prod to see how long it will reconcile.
to be tested as well
yes, will be deprecated if PR is stable
yes perhaps agreed, with this scale it should be fine, Long term plan...we should use a different backend imo, will discuss about the options later.
needs further analysis
ok good catch, fixed
yeah seems like metrics , reporting will have to be updated
will run AI on that, to finish all the details
e2e tests need work, the reconciler now requires zoneclass to be specified, so can't run it in parallel as each test cleans up the zoneclass resulting in conflicts.
ok might take a few seconds yeah
needs to be tested again and again
that's fine and expected
ok cleanups might be necessary, good for testing now
yes, TODO added, never implemented before
oh yes, block removed
clean up docs later
never used yes
WILL BE TESTED!!!
yes, right now branch is deployed on staging in infra
no...do not delete a DNSZoneClass in prod or staging PLS, do not pls do not.
yes needs to be cleaned up
|
… DNSRecordSet and DNSZone reconciliation
ecv
left a comment
There was a problem hiding this comment.
Re-approving at f207b7b. The previous approval was dismissed by the push, and that push is an improvement: error paths now report ConditionFalse, the BuildOwnerRRSet result is checked so an empty payload cannot delete a live RRset, and the status list is sorted before the first write.
Four things are knowingly left open, tracked so they are not lost if this merges first:
- #92, the remaining half.
EnsureRecordSetstill returns nil regardless of outcome, so a failed write now reports honestly but nothing retries it. - #91. The zone fetch and the class check still sit above the deletion split, in this reconciler and in the zone one.
- The status timestamp is minted on every call, so an error path still re-triggers itself through a watch with no predicate and nothing pacing it.
MaxConcurrentReconcilesis unset on the new controller, so it runs one worker where the retired one ran four.
… in EnsureRecordSet
…emoving status parameter from recordSetErrorStatus - fixes lint errors
Reworks reconcile loop.
For details refer to:
docs/enhancements/dnsrecordset-reconcile-consolidation.md
https://github.com/datum-cloud/dns-operator/blob/ba4bca40fce83f4f635ffe24fed2b41ee7285407/docs/enhancements/dnsrecordset-reconcile-consolidation.md
Addresses #58 #59.