Repository navigation
feat(custody): Add the commissioning kinds - #195
Conversation
02825ef to
c147372
Compare
8c6052e to
c73530a
Compare
a7c1973 to
87b08a6
Compare
Add DeviceCommissioning, with DeviceCommissioningPlan and DeviceCommissioningPlanApproval, as the commissioning proposal describes. A plan qualifies only when someone other than its author approves its exact generation and digest. Approver and author are told apart by username ignoring case; UIDs are compared only when both carry one, since a client certificate carries none. A Device's current plan is the one qualified plan that selects it and that no other selecting plan supersedes. No spec holds an object UID. An approval's name is the plan's name and a suffix derived from the plan's UID, and a commissioning names that approval, so a plan recreated under the same name inherits nothing. The Device incarnation is the device-uid label. Custody admits a commissioning from holder None, or from Service to settle a commissioning hold, under the Device's current plan with an exact copy of its content. A proven verdict ends Succeeded with a Passed or Failed result; anything else ends OutcomeUnknown. Two seams let a kind derive its deadline from its inputs and keep each Device's latest success past retention. Every mode's coordinator role reads the new kinds. The creator webhook and the standalone creator policy govern them, and a test keeps both packaged resource lists in step. The multi-plane CRD rule phase refuses a write that breaks each new CEL rule, and the standalone smoke and the harness custody reads cover the new kinds. Nothing runs a commissioning worker yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87b08a6 to
6a28951
Compare
kevwilliams
left a comment
There was a problem hiding this comment.
Hold: a Failed commissioning can settle a commissioning hold without proving the server identity.
- validateCommissioningEvidence returns early for Failed, so serial, system UUID and BMC key go unchecked. If the operation then ends Succeeded, the Settles rule clears a Service hold left by an OutcomeUnknown run cut off mid-flash or mid-burn-in.
- Fix: require the identity check for Failed results too, or settle a hold only on a Passed verdict.
- Add a test that a Failed verdict does not settle a hold.
ecv
left a comment
There was a problem hiding this comment.
Request changes.
The new kinds, roles and protected resources are sound, but a Failed commissioning result is accepted without proving the server's identity, and that result can still settle a recovery hold.
- Agree with kevwilliams:
validateCommissioningEvidenceininternal/custody/commissioning.goreturns early for Failed before the serial, system UUID and BMC key are compared with the admission snapshot. If the operation then ends Succeeded,Settles: DeviceCommissioning(commissioning.go:222) clears a Service hold left by an OutcomeUnknown run cut off mid-flash or mid-burn-in, on evidence from a server nobody identified. Check identity for Failed too, or settle a hold only on a Passed verdict, and add a test that a Failed verdict does not settle a hold. - Plan author and approver separation holds in the coordinator, not at admission:
qualifiesrefuses an approval whosespec.creatoris notdistinctfrom the plan's creator (case-insensitive username, UID when both have one), and the creator webhook pinsspec.creatorto the authenticated caller on create and update. One identity cannot make a plan qualify by writing both objects. The approval name is derived from the plan UID and the digest is pinned, so a replaced plan needs a new approval. - Roles are least-privilege: author gets plans create/delete, approver gets approvals create/delete, operator gets commissionings create, and none gets update or patch. The coordinator is the only status writer. Nothing prevents one person from holding both the author and approver roles, because the check compares usernames; two accounts for one human pass.
- The creator webhook covers all three new plurals and stays
failurePolicy: Fail;TestPackagedResourcesMatchties the three rule lists together.
Follow-ups:
- Add an IAM-level guard (or a documented rule) that the author and approver roles are never bound to the same principal, so separation does not rest on the username comparison alone.
- This PR's base is
feat/manual-inventory-records, notmain, so it cannot merge until that branch does. Re-review the delta once the base lands.
A Failed commissioning verdict skipped the identity check, so a verdict about another server could end Succeeded and clear a commissioning hold left by a run cut off mid-flash or mid-burn-in. Every result now records the serial number, system UUID and BMC key the admission snapshot holds. A kind may also decide from a success's evidence whether it settles the hold it was admitted to settle; a commissioning settles one only with a Passed verdict. Live results and rebuild apply the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The username comparison at admission was the only stated guard on plan separation. State the IAM rule it backs: the author and approver roles are never bound to one principal or to groups that share a member. Fleet does not own IAM bindings, so the rule is documented on both roles, and the packaged-IAM test now follows inherited roles and refuses any packaged PolicyBinding that grants one subject both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, both. Both points are fixed at c2cc6b6.
|
kevwilliams
left a comment
There was a problem hiding this comment.
Every verdict now proves the server identity against the admission snapshot, only a Passed result settles a hold, and a test pins that a Failed one does not.
ecv
left a comment
There was a problem hiding this comment.
Approve.
Both holds are closed: every commissioning verdict now proves the admitted server's identity, and only a Passed result settles a hold. I diffed the PR's own commits (6a28951, f7c5d21, c2cc6b6); the old head is no longer fetchable after the rebase, so I read the fix commits against the earlier findings.
- Agree with kevwilliams, now addressed:
validateCommissioningEvidencecompares serial, system UUID and BMC key with the admission snapshot before the Failed branch, so a Failed verdict from another server is refused. New cases cover a Failed verdict with no serial, another serial, another UUID and another key. - Failed no longer settles a hold:
SettlesWith: commissioningPassedgates theSettlesrule, and rebuild reads the same rule from recorded evidence. The new test "a Failed verdict does not settle a commissioning hold" leaves a Service hold from an OutcomeUnknown run, ends a second run Succeeded with a Failed verdict, checks the hold stays, then deletes the custody, rebuilds and checks again. - Follow-up from my first review, addressed: both role descriptions now say never to bind the author and approver roles to one principal or to groups sharing a member. This stays a documented rule, not an enforced one.
- CI is green on this head, including go-test custody-1/2/3. The envtest suites skip locally without KUBEBUILDER_ASSETS, so I did not run my own tamper test (removing the
SettlesWithguard); CI is the evidence.
Follow-ups:
- This PR is based on
feat/manual-inventory-records, so it merges only after that branch does.
Related to #185. Targets the feature branch now that #182 and #219 have merged.
Staff can now ask to commission a server. A plan qualifies only when a second person, not its author, approves its exact content. Nothing runs a commissioning until #196 adds the site worker, so one created before then holds its server until its deadline and ends with an unknown outcome.
Landing
The capacity stack lands first: #182, #219, #208 and #232 (all merged), then #195, #196, #200 and #201. Overlapping PRs on other stacks (cleaning #193, #202, #205, #206 and #207, power #190, NSO and IPAM #198 and #225, virtual media #229) rebase onto it, and #205 adds its NVMe lab drive on top of the lab model in #196.
Decisions for a person
Test plan
🤖 Generated with Claude Code