Skip to main content

Module cluster_reader

Module cluster_reader 

Source
Expand description

Cluster reader trait for the lookup() template function

This module decouples the engine from a specific Kubernetes client. sherpack-engine defines the trait; concrete implementations live in crates that have a cluster client (e.g. sherpack-kube::lookup).

§Helm-compatible semantics

lookup is non-fatal: errors (404, 403, network, unknown kind) all resolve to an empty result rather than failing the render. Errors are surfaced through LookupState::take_warnings() so the caller can log them after the render.

§Determinism caveat

Templates that use lookup are non-deterministic by construction: the same Pack rendered against different clusters produces different manifests. This is the same trade-off Helm makes; document it loudly.

§Wiring

use sherpack_engine::{Engine, cluster_reader::ClusterReader};
use std::sync::Arc;

let reader: Arc<dyn ClusterReader> = Arc::new(MyReader::new());
let engine = Engine::builder()
    .strict(true)
    .with_cluster_reader(reader)
    .build();

Structs§

LookupState
Per-render state for the lookup() function.

Traits§

ClusterReader
Reads existing cluster resources at template-render time.