pub async fn reconcile_zone_records(
client: Client,
dnszone: DNSZone,
stores: &Stores,
) -> Result<Vec<RecordReferenceWithTimestamp>>Expand description
Reconciles DNS records for a zone by discovering records that match the zone’s label selectors.
Event-Driven Architecture: This function implements the core of the zone/record ownership model:
- Discovers records matching the zone’s
recordsFromlabel selectors - Tags matched records by setting
status.zoneRef(triggers record reconciliation via watches) - Untags previously matched records by clearing
status.zoneRef(stops record reconciliation) - Returns references to currently matched records for
DNSZone.status.recordstracking
Record reconcilers watch status.zoneRef to determine which zone they belong to.
When status.zoneRef is set, the record is reconciled to BIND9.
When status.zoneRef is cleared, the record reconciler marks it as "NotSelected".
Before a record is untagged, its data is deleted from the zone’s primary
BIND9 instances. If that DNS deletion fails, the record is kept selected
(and in status.records) so the cleanup is retried on the next
reconciliation instead of orphaning the data in BIND9.
§Arguments
client- Kubernetes API client for querying DNS recordsdnszone- TheDNSZoneresource with label selectorsstores- Context stores for resolving instances and creatingBind9Managers
§Returns
Ok(Vec<RecordReference>)- List of currently matched DNS recordsErr(_)- If record discovery or tagging fails
§Errors
Returns an error if Kubernetes API operations fail.