resolve_ips_from_annotation

Function resolve_ips_from_annotation 

Source
pub fn resolve_ips_from_annotation(
    annotations: &BTreeMap<String, String>,
) -> Option<Vec<String>>
Expand description

Returns the explicit IP overrides from the bindy.firestoned.io/ip annotation.

The value may be a single IP ("10.0.0.1") or a comma-separated list ("10.0.0.1,10.0.0.2,10.0.0.3"). Whitespace around each entry is trimmed and empty entries are skipped, preserving order and duplicates.

Every entry is validated as an IPv4 dotted-quad before it is accepted (audit finding P2-6). This annotation is set by whoever can edit the source Ingress / Service / Route — i.e. a namespace tenant — and whatever survives here is written verbatim into ARecordSpec.ipv4Addresses and rendered into a zone file. IPv6 literals are rejected too: ARecord is IPv4-only, so an IPv6 address here would produce an invalid A record.

Invalid entries are dropped with a warning rather than failing the whole record, so one fat-fingered entry in a list does not take down valid DNS.

Returns None if the annotation is absent, empty, contains only separators/whitespace, or if no entry is a valid IPv4 address. None (rather than an empty Vec) matters: it lets resolve_ips fall through to default_ips and then the load-balancer status, whereas Some(vec![]) would create a record with no addresses.