Expand description
Substrate primitive for the Api::namespaced::<ConfigMap> binding
every workspace consumer of the K8s ConfigMap built-in reaches
for when it needs a namespace-scoped typed handle.
Owns the 1-link chain
let api: Api<ConfigMap> = Api::namespaced(<client>, <ns>);that every ConfigMap-writer (receipt writer) + ConfigMap-reader (receipt-collection walker + inbound test-report fetcher) hand- authored pre-lift at each namespace-scoped handle-construction site.
Sibling to the K8s-typed-handle family already lifted by:
tatara_reconciler::context::ProcessReconcilerContext::{process_api,process_table_api}— the reconciler’s tatara-CRD-typed handle binders.tatara_pool_reconciler::context::PoolReconcilerContext::{pool_api,allocation_api}— the pool-reconciler’s tatara-CRD-typed handle binders.tatara_github_watcher::handler::HandlerState::allocation_api— the github-watcher’s per-request allocation-typed handle binder.
All three sibling lifts closed the Api::namespaced(<client>.clone(), <ns>) shape at a controller-owned context struct, one binder per
typed CRD. This primitive closes the SAME shape at a k8s-openapi-
typed BUILT-IN (ConfigMap) for the two consumer binaries
(tatara-closed-loop-probe, tatara-export-worker) that neither
own a reconciler context nor thread through a shared per-request
state, so the workspace-side substrate rather than a per-crate
context is the ONE owner of the ConfigMap-typed handle binding.
Pre-lift the 1-link let api: Api<ConfigMap> = Api::namespaced( <client>, <ns>) chain recurred at FOUR hand-authored consumer
sites across TWO crates past the ★★ PRIME-DIRECTIVE ≥ 2
duplication threshold:
tatara-closed-loop-probe::main::write_receipt— the closed-loop auth probe’s receipt-CM writer. Threads through the CM handle for the create-then-409-patch idempotent write.tatara-export-worker::main::read_artifact(ArtifactVariant:: TestReportarm) — the export worker’s inbound test-report ConfigMap reader.tatara-export-worker::main::read_artifact(ArtifactVariant:: Receiptsarm) — the export worker’s receipt-collection walker over the Process’s namespace.tatara-export-worker::main::write_receipt— the export worker’s own receipt-CM writer (SSA-side, distinct posture from the closed-loop probe’s create-then-409-patch, but the ns-scoped handle binding is the same shape).
Each site consumes the returned Api<ConfigMap> either through a
.get(&name) reader chain (the two read-side consumers), a
crate::create::default(&api, &cm).await writer chain (the closed-
loop-probe consumer), or an .patch(name, &pp, &Patch::Apply(&cm))
SSA-writer chain (the export-worker writer) — the primitive returns
the Api<ConfigMap> verbatim so all four consumer shapes ride
unchanged.
§Naming
The primitive is named namespaced — the scope-slot axis
(Api::namespaced vs Api::all vs Api::default_namespaced vs
Api::namespaced_with) is the one it closes. A caller reads
configmap::namespaced(client, ns) and understands they are binding
a ns-scoped ConfigMap handle — the ns slot is required (no fallback
to the client’s default namespace), and the concrete type is fixed
at THIS primitive so no consumer can drift the type-parameter slot
at its callsite. A future cluster-wide walker (over every ConfigMap
in every namespace) composes a peer all primitive on this module;
a future default-namespaced variant composes a peer
default_namespaced — each closes a distinct scope slot at ONE
substrate owner, mirroring the Api API’s own scope-verb axis.
Fixing the concrete K = ConfigMap at the primitive lands three
guarantees the pre-lift 4-site sprawl could not offer:
- the two
use k8s_openapi::api::core::v1::ConfigMapimports at the two callsite crates are the ONE typed edge to the K8s built- in; any future rename or module-path shift lands here; - a regression that swapped
Api::namespacedforApi::allat ONE callsite is now structurally impossible — the scope choice is owned by the primitive’s name; - a future migration to
Api::namespaced_with(client, ns, &ar)(for the same ns-scoped posture through the dynamic-object channel, mirroringtatara-reconciler::ssapply’s DynamicObject consumer) lands at ONE point — every downstream consumer inherits the shift mechanically.
Functions§
- namespaced
- Bind a namespace-scoped typed
Api<ConfigMap>handle forClient+ns. - with_
data - Compose a namespaced
ConfigMapresource carrying a typedString → StringBTreeMappayload, optionally labeled.