replay_zone_records

Function replay_zone_records 

Source
pub async fn replay_zone_records(
    client: &Client,
    stores: &Stores,
    zone_name: &str,
    record_refs: &[RecordReferenceWithTimestamp],
    primary_refs: &[InstanceReference],
) -> RecordReplayOutcome
Expand description

Re-push every record CR selected by a zone into that zone on BIND9.

§Why this exists

BIND9 operand pods hold zone data in ephemeral storage. When a pod - or the whole Deployment - is wiped, the zone is gone, and the zone reconciler recreates it from spec: SOA and NS records only. The server is then authoritative for a zone with no data, so it answers authoritative NXDOMAIN (or, with recursion and forwarders enabled, silently returns the public answer) for every name it should be serving. Record CRs are not replayed by their own controllers because, from Kubernetes’ point of view, nothing about them changed.

This function closes that gap: whenever the zone reconciler creates a zone on any endpoint, it replays the zone’s records immediately, in the same reconciliation, rather than waiting for an unrelated record event.

The push itself is idempotent (each record type queries the server first and writes an RRset only when it differs), so replaying against endpoints that already hold the data costs one DNS query per record and changes nothing.

§Arguments

  • client - Kubernetes API client
  • stores - Context stores used to build a Bind9Manager per instance
  • zone_name - DNS zone name (e.g. “example.com”)
  • record_refs - The zone’s status.records[] entries to replay
  • primary_refs - PRIMARY instances to push to (secondaries pull via AXFR)

§Returns

A RecordReplayOutcome describing what was pushed. Individual record failures are collected rather than propagated so that one broken record cannot block the recovery of every other record in the zone.