Skip to main content

ClusterReader

Trait ClusterReader 

Source
pub trait ClusterReader: Send + Sync {
    // Required methods
    fn lookup_one(
        &self,
        api_version: &str,
        kind: &str,
        namespace: &str,
        name: &str,
    ) -> Option<JsonValue>;
    fn lookup_list(
        &self,
        api_version: &str,
        kind: &str,
        namespace: &str,
    ) -> Vec<JsonValue>;
}
Expand description

Reads existing cluster resources at template-render time.

Implementations MUST be non-fatal: any error (network, RBAC, missing resource, unknown kind) MUST resolve to None / empty list.

Implementations are responsible for any sync/async bridging (e.g. tokio::task::block_in_place) — the trait is intentionally sync to match MiniJinja’s function signature requirements.

Required Methods§

Source

fn lookup_one( &self, api_version: &str, kind: &str, namespace: &str, name: &str, ) -> Option<JsonValue>

Look up a single resource by name. Returns None if not found or any error occurred.

namespace == "" means cluster-scoped or any namespace, depending on the kind’s scope.

Source

fn lookup_list( &self, api_version: &str, kind: &str, namespace: &str, ) -> Vec<JsonValue>

List all resources of a kind in a namespace. namespace == "" lists across all namespaces (or cluster-wide for cluster-scoped resources). Returns an empty Vec on error.

Implementors§