list_all_paginated

Function list_all_paginated 

Source
pub async fn list_all_paginated<K>(
    api: &Api<K>,
    list_params: ListParams,
) -> Result<Vec<K>>
where K: Resource<DynamicType = ()> + Clone + DeserializeOwned + Debug, K::DynamicType: Default,
Expand description

List all resources with automatic pagination.

Fetches resources in pages to reduce memory usage and API server load. This is especially important when listing hundreds or thousands of resources (e.g., 1000+ DNSZones per namespace).

§Arguments

  • api - Kubernetes API client for the resource type
  • list_params - Base list parameters (labels, fields, etc.)

§Returns

Vector of all resources, fetched in pages

§Example

use kube::{Api, Client, api::ListParams};
use bindy::crd::DNSZone;
use bindy::reconcilers::pagination::list_all_paginated;

let client = Client::try_default().await?;
let api: Api<DNSZone> = Api::namespaced(client, "default");

let zones = list_all_paginated(&api, ListParams::default()).await?;
println!("Found {} zones", zones.len());

§Errors

Returns an error if Kubernetes API operations fail.