pub fn check_for_duplicate_zones(
dnszone: &DNSZone,
zones_store: &Store<DNSZone>,
) -> Option<DuplicateZoneInfo>Expand description
Checks if another zone has already claimed the same zone name across any BIND9 instances.
This function prevents multiple teams from creating conflicting zones with the same fully qualified domain name (FQDN). A conflict exists if:
- Another DNSZone CR has the same
spec.zoneName - That zone is NOT the same resource (different namespace/name)
- That zone has at least one instance configured (status.bind9Instances is non-empty)
- Those instances have status != “Failed”
§Arguments
dnszone- The DNSZone resource to check for duplicateszones_store- The reflector store containing all DNSZone resources
§Returns
Some(DuplicateZoneInfo)- If a duplicate zone is detected, with details about conflictsNone- If no duplicate exists (safe to proceed)
§Examples
ⓘ
use tracing::warn;
use bindy::reconcilers::dnszone::check_for_duplicate_zones;
if let Some(duplicate_info) = check_for_duplicate_zones(&dnszone, &zones_store) {
warn!("Zone {} conflicts with existing zones: {:?}",
duplicate_info.zone_name, duplicate_info.conflicting_zones);
// Set status condition to DuplicateZone and stop processing
}