pub fn get_instances_from_zone(
dnszone: &DNSZone,
bind9_instances_store: &Store<Bind9Instance>,
) -> Result<Vec<InstanceReference>>Expand description
Get instances from a DNSZone based on bind9_instances_from selectors.
This function:
- Uses the reflector store for O(1) lookups without API calls
- Single source of truth:
DNSZoneowns the zone-instance relationship
§F-003 mitigation: cross-namespace targeting requires platform-admin opt-in
A label selector match is not sufficient to enrol a Bind9Instance in
the zone. The instance is included only when either:
- The instance lives in the same namespace as the
DNSZone, or - The instance carries the
crate::constants::ANNOTATION_ALLOW_ZONE_NAMESPACESannotation whose value contains the zone’s namespace (or the wildcardcrate::constants::ALLOW_ZONE_NAMESPACES_WILDCARD).
The annotation is metadata on the Bind9Instance, which is owned by
the platform admin (only they have RBAC on the namespace where the
instance lives). This preserves the cluster-wide-operator contract:
the platform admin keeps full control of who can claim their
instances, expressed through a platform-admin-controlled annotation,
while still preventing the F-003 hijack — labels on the instance side
are not a security boundary (they are discoverable via list/watch and
any tenant can write any matchLabels they want), but annotations on
the platform-owned instance are.
§Arguments
dnszone- TheDNSZoneresource to get instances forbind9_instances_store- Reflector store ofBind9Instance
§Returns
Ok(Vec<InstanceReference>)- List of instances serving this zoneErr(_)- If no instances pass both the selector match and the namespace gate
§Errors
Returns an error if no instances pass the selector + namespace gate, or
if spec.bind9_instances_from is missing or empty.