resolve_ips_from_gateways

Function resolve_ips_from_gateways 

Source
pub async fn resolve_ips_from_gateways(
    client: &Client,
    route_namespace: &str,
    parent_refs: &[ParentReference],
    gateway_services: &BTreeMap<String, GatewayServiceTarget>,
) -> Option<Vec<String>>
Expand description

Follows a route’s parentRefs back to the serving Gateway(s) and resolves their external IP(s).

For each parentRef that resolves to a Gateway, Scout resolves the IP by:

  1. reading the Gateway’s status.addresses (IP-typed) — no extra configuration required; works as long as the gateway controller populates its own status.
  2. if status.addresses is empty, looking up the gateway class in the operator-configured gateway_services map and reading the external IP of the mapped LoadBalancer Service.

Returns the de-duplicated IPs in discovery order, or None when nothing resolves. Individual lookup failures are logged and skipped so one unreachable Gateway does not blank out the others.

§Arguments

  • client - Local cluster client (Gateways and Services live on the workload cluster)
  • route_namespace - Namespace of the route, used as the default parentRef namespace
  • parent_refs - The route’s spec.parentRefs
  • gateway_services - Optional fallback map: gatewayClass → Service used only when status.addresses is absent