for_each_instance_endpoint_with_policy

Function for_each_instance_endpoint_with_policy 

Source
pub async fn for_each_instance_endpoint_with_policy<F, Fut>(
    client: &Client,
    instance_refs: &[InstanceReference],
    with_rndc_key: bool,
    port_name: &str,
    policy: EndpointFailurePolicy,
    operation: F,
) -> Result<(Option<String>, usize)>
where F: Fn(String, String, Option<RndcKeyData>) -> Fut, Fut: Future<Output = Result<()>>,
Expand description

Execute an operation on all endpoints for a list of instance references, with an explicit failure policy for per-instance lookups.

Same as for_each_instance_endpoint, but the caller chooses how to treat RNDC-key and endpoint lookup failures (see EndpointFailurePolicy). Deletion cleanup paths should use EndpointFailurePolicy::SkipUnavailable so that a missing RNDC Secret or an instance with zero ready endpoints does not block finalizer removal forever.

§Arguments

  • client - Kubernetes API client
  • instance_refs - List of instance references to process
  • with_rndc_key - Whether to load and pass RNDC keys for each instance
  • port_name - Port name to use for endpoints (e.g., “rndc-api”, “dns-tcp”)
  • policy - How to treat per-instance RNDC-key/endpoint lookup failures
  • operation - Async closure to execute for each endpoint

§Returns

  • Ok((first_endpoint, total_endpoints)) - First endpoint found and total count

§Errors

Returns an error if all operations fail, or if RNDC-key/endpoint lookups fail and the policy does not allow skipping them.