Skip to main content

Module patch

Module patch 

Source
Expand description

Substrate primitive for the merge-patch idiom over the /status subresource of any kube Resource.

Owns the 2-link chain

let body = json!({ "status": <typed> });
api.patch_status(name, &PatchParams::default(), &Patch::Merge(&body)).await

that every controller-side writer hand-authored pre-lift at each phase-transition + observed-fanout site.

Sibling to the SSA-side substrate primitive crate::api_version-adjacent tatara_reconciler::ssapply::apply_patch_params (which owns the PatchParams::apply(<mgr>).force() peer on the server-side-apply axis). Together, the two primitives own the two wire-side write-posture axes the workspace’s controllers stamp:

  • Patch::Merge + PatchParams::default() — status-subresource writes, applied here by every phase-transition writer in the tatara-pool-reconciler (allocation controller, pool controller) and the tatara-reconciler (Process status writer).
  • Patch::Apply + PatchParams::apply(<mgr>).force() — rendered FluxCD resource applies + RELEASED_FROM marker + the ProcessTable.status.claims writer.

§Return type + #[must_use]

Returns the reconstructed K on success — matches Api::patch_status verbatim. Pool + Process controllers today discard the returned K (let _ = merge_status(...).await; after AllocationDecision / phase-transition branches), but the primitive keeps the return in the signature so a future writer that needs the reconciled resource-version / observed-generation from the same wire round-trip doesn’t have to re-fetch. #[must_use] on the returned Future keeps a caller from building the patch call and dropping it un-awaited — the same silent-drop defect the pre-lift free-chain form quietly permitted.

Functions§

apply_patch_params
Server-side-apply PatchParams with field_manager bound to the caller-supplied slot and force = true — the ONE substrate primitive owning the PatchParams::apply(<mgr>).force() incantation every workspace SSA writer restated by hand pre-lift.
merge_status
Merge-patch the /status subresource of any kube Resource with a typed status value.
merge_status_body
Compose the merge-patch wire body {"status": <status>} — the pure step merge_status performs before handing off to Api::patch_status.