pub async fn default<K>(api: &Api<K>, obj: &K) -> Result<K, Error>Expand description
Create a kube Resource through its namespaced or cluster-scoped
Api with the default PostParams posture.
Owns the 2-link wire-side chain
api.create(&PostParams::default(), &obj) at ONE substrate owner
across every workspace consumer. Sibling to
crate::patch::merge on the wire-verb axis (POST vs PATCH), and
to crate::patch::apply_patch_params on the wire-posture axis
(default PostParams vs SSA PatchParams).
A future normalization of the create posture (an injectable
field-manager slot for observability at the API server’s ownership
queries, a dry-run gate for one-shot dry-runs, a resourceVersion
precondition slot for optimistic concurrency at seed sites) lands at
THIS ONE function and every downstream consumer inherits the upgrade
mechanically — no per-site edit at any of the five listed callers or
at future consumers (a future controller emitting a seed CR, a
future ephemeral-env bootstrap job spawn, a future receipt-writer
seed).
The returned K matches Api::create verbatim — the reconstructed
resource carrying server-populated slots (uid, resourceVersion,
creationTimestamp). Consumers who discard it (the pool
controller’s Ok(_) => spawned += 1 arms, the watcher’s
Ok(_) => (StatusCode::CREATED, ...) arm, the probe’s Ok(_) => Ok(())
arm) keep the return in the signature so a future writer that needs
the server-populated slots (e.g. to chain a subsequent status write
against the exact resourceVersion the create returned) doesn’t
have to re-fetch.
Theory anchor: THEORY.md §VI.1 (generation over composition — the
2-link api.create(&PostParams::default(), &obj) chain recurred at
5 hand-authored sites past the ★★ PRIME-DIRECTIVE ≥ 2 duplication
trigger and is lifted onto the ONE workspace-wide substrate owner
here). THEORY.md §II.1 invariant 5 (composition preserves proofs —
the pin block below binds the primitive at fail-before-pass-after
granularity, so a regression that drifts PostParams::default() to
a non-default posture — a stray dry_run, an accidental
field_manager — surfaces at create::tests::* rather than as
silent operator-facing skew across the five consumer sites).