Expand description
Substrate primitive for the Api::all(<client>) binding every
workspace consumer of a cluster-scoped typed Api<K> handle
reaches for when it needs a bare cluster-wide typed collection
from an owned Client (no namespace slot, no per-request
reconciler context in scope).
Owns the 1-link chain
let api: Api<K> = Api::all(<client>);that every cluster-scoped tatara-CRD / K8s-built-in binder site
hand-authored pre-lift at each Api::all(self.kube.clone())
callsite.
§Peer axis
Sibling to crate::process_api::namespaced +
crate::configmap::namespaced on the (scope × K) axis pair —
those primitives own the Api::namespaced(<client>, <ns>) shape
at a fixed K = Process / K = ConfigMap; this primitive owns
the Api::all(<client>) shape at any K: Resource<DynamicType = ()>. The pre-lift 4-site sprawl split across two crates spanned
FOUR distinct K bindings (Process + ProcessTable +
EphemeralPool + EphemeralAllocation), so the primitive fixes
the scope slot structurally at Api::all and leaves the K slot
generic — the callsite’s return-type annotation (or its enclosing
-> Api<K> signature) picks the K, and rustc infers it end-to-end
from the callsite’s typed handle usage.
§Pre-lift call-site history
The Api::all(<client>.clone()) chain recurred at FOUR
hand-authored production sites past the ★★ PRIME-DIRECTIVE ≥ 2
duplication threshold, spanning two crates:
tatara-reconciler::context::Context::process_table_api— the cluster-scopedApi<ProcessTable>binder for the /proc singleton, fed into the top-levelController::new(table_api, …)watch wiring + into every downstream ProcessTable consumer (bootstrap_process_tableseed,table_controllerreconcile loop,check_ptbl_in_syncdiagnostic).tatara-reconciler::context::Context::processes_all_api— the cluster-scopedApi<Process>binder for the reap-children walker (phase_machine::handle_exitingfiltering byspec.identity.parent), the claim-arbiter enumerate (table_controller::reconcilegrouping by${cluster}/${app}), and the top-levelController::new(...)wiring inmain.rswhen--watch-namespaceis empty.tatara-pool-reconciler::context::PoolContext::pools_all_api— the cluster-scopedApi<EphemeralPool>binder for the top-levelController::new(pool_api, …)watch wiring in the pool reconciler’smain.rs.tatara-pool-reconciler::context::PoolContext::allocations_all_api— the cluster-scopedApi<EphemeralAllocation>binder for the top-levelController::new(alloc_api, …)watch wiring in the pool reconciler’smain.rs.
Each pre-lift site restated Api::all(self.kube.clone())
verbatim, with the .clone() on the ambient Client field
feeding the primitive’s owned-Client slot. Post-lift each
consumer reads tatara_process::api::all(self.kube.clone()) and
the cluster-scoped typed-handle binding lives at ONE substrate
owner across every CRD binding.
§Compounding
A future normalization of the cluster-scoped Api-handle posture (a
wired-in tracing span for handle construction, a client-side QPS
limiter, a fixture-backed client for CI/smoke-tests, a per-CRD
watch filter that pre-warms Controller::new’s stream cache)
lands at THIS ONE function and every downstream consumer — the
four current callsites AND every future cluster-scoped Api
binding site (a future Api<EphemeralAllocationBinding> for the
P3 kenshi-runner lift, a future audit-walker enumerating every
Process across a subshard) inherits the upgrade mechanically.
§Naming
The module is named [api] — a bare top-level submodule under
tatara-process naming the axis it closes (“build a cluster-
scoped typed Api<K> handle at ONE substrate primitive”). The
peer namespaced-scope binders live at crate::process_api (K
= Process) and crate::configmap::namespaced (K = ConfigMap)
rather than under this module because those primitives fix a K
structurally — the cluster-scoped axis instead leaves K generic
and lets the callsite pick, so a bare [api] name best matches
its polymorphic contract.
Functions§
- all
- Bind a cluster-scoped typed
Api<K>handle from an ownedClientfor any K that satisfies the standardkube::Resourceprojection with a zero-sizedDynamicType(every derive-generated CRD + every K8s built-in Rust binding meets this bound). - namespaced
- Bind a namespace-scoped typed
Api<K>handle from an ownedClient+&strnamespace for any K that satisfies the standardkube::Resourceprojection with a zero-sizedDynamicType(every derive-generated CRD + every K8s built-in Rust binding meets this bound).