1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
//! Substrate primitive for the create-verb wire idiom over any kube
//! [`Resource`].
//!
//! Owns the 2-link chain
//!
//! ```text
//! api.create(&PostParams::default(), &obj).await
//! ```
//!
//! that every controller-side writer hand-authored pre-lift at each
//! spawn / bind / seed / receipt-write site.
//!
//! Sibling to the patch-family substrate primitives in [`crate::patch`]
//! on the wire-verb axis: [`crate::patch::merge`] owns the primary-
//! resource merge-patch posture, [`crate::patch::merge_status`] owns
//! the `/status`-subresource merge-patch posture,
//! [`crate::patch::apply_patch_params`] owns the server-side-apply
//! `PatchParams` composition; this primitive completes the family with
//! the create (`POST`) verb — the third wire-verb axis every workspace
//! controller stamps at its idempotent-write sites.
//!
//! Pre-lift the 2-link `api.create(&PostParams::default(), &obj)` chain
//! recurred at FIVE hand-authored consumer sites across FOUR crates:
//! - `tatara-pool-reconciler::controller_pool::spawn_members` — the
//! spawn-branch new-member Process create.
//! - `tatara-pool-reconciler::controller_pool::apply_convergence_action`
//! (`ConvergenceAction::CreateMember` arm) — the desired-loop spawn
//! peer of the site above.
//! - `tatara-reconciler::patch::ensure_process_table` — the cluster-
//! scoped ProcessTable singleton seeder.
//! - `tatara-github-watcher::handler::handle_pr_event` — the PR-event
//! allocation-create site.
//! - `tatara-closed-loop-probe::main::write_receipt_configmap` — the
//! receipt ConfigMap create-then-409-retry seed (its 409 retry-arm
//! already routes through [`crate::patch::merge`] and
//! [`crate::kube_error::is_conflict`], leaving the create-verb the
//! last unlifted link in that chain).
//!
//! Four of the five sites additionally pair the create call with the
//! `is_conflict` guard already lifted in [`crate::kube_error`] — the
//! compound "create-or-treat-409-as-ok" idiom the workspace stamps at
//! every optimistically-created resource. Post-lift both halves of the
//! compound (`create::default` + `kube_error::is_conflict`) ride
//! through ONE substrate owner apiece so the compound reads exactly
//! `create::default(&api, &obj) → is_conflict` at each callsite.
//!
//! ### Naming
//!
//! The primitive is named [`default`] — the `PostParams::default()`
//! slot is the axis it closes, mirroring the naming discipline the
//! rest of the wire-verb family follows (`merge` names the `Merge`
//! posture, `merge_status` names the `/status` subresource, and
//! `apply_patch_params` names the `apply(...)` posture). A caller reads
//! `create::default(&api, &obj)` and understands they are dispatching
//! through the default `PostParams` posture — no `dry_run`, no
//! `field_manager` bound (create writes are not SSA and do not
//! participate in the field-manager ownership model).
use ;
use Resource;
use ;
use Debug;
/// 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).
pub async