Repository navigation
feat(capacity): Derive capacity status from commissioning - #200
Conversation
c982b26 to
0f5e486
Compare
f0a1171 to
8983dbf
Compare
0f5e486 to
a9d9b36
Compare
8983dbf to
c18fd24
Compare
a9d9b36 to
ee30ce8
Compare
c18fd24 to
2cd8c21
Compare
ee30ce8 to
4ff43c3
Compare
4d33448 to
82aac21
Compare
4ff43c3 to
c3c3e51
Compare
d663aff to
197ab3f
Compare
c3c3e51 to
3888640
Compare
197ab3f to
0a29e08
Compare
3888640 to
4edbd10
Compare
0a29e08 to
e90aba4
Compare
4edbd10 to
402c071
Compare
e90aba4 to
1d04800
Compare
1d04800 to
2ddd5f6
Compare
49ccca5 to
b7ceaad
Compare
2ddd5f6 to
f349fc5
Compare
kevwilliams
left a comment
There was a problem hiding this comment.
Hold: after rollout synthetic staging has no allocatable capacity, and the cutover runbook never says why.
- ensureObservation and the synthetic Prepared/Healthy/Available conditions are removed, so every existing capacity reads Prepared=False NotCommissioned. That fails closed correctly, but config/README.md never mentions commissioning, so step 8, "verify a fresh allocation", fails with insufficient capacity.
- Fix: add cutover steps that create the plan, approval and a commissioning per synthetic Device, including the plan-approver and operator identities and the new enrollment hardware field.
ecv
left a comment
There was a problem hiding this comment.
Approve with follow-ups.
Capacity status is now derived from commissioning evidence by a dedicated projector, and the allocator decides from the same projection on live inputs, so nothing a device has not earned is offered. The follow-ups are the rollout steps and a few permissions that can be narrower.
- Capacity cannot be reported for an uncommissioned device:
ProjectCapacityininternal/custody/capacity.gomakes Prepared false without a succeeded commissioning, a Passed result, a plan whose reference matches the evidence, and a Device UID that matches. Healthy then needs evidence inside the plan's lifetime, current discovery, and the recorded serial, system UUID and BMC key unchanged. Available needs Verified custody, no hold, no holder, an enabled policy, no duplicate identity and a resolving cleaning policy. - Regression is handled: the latest succeeded commissioning is read live, so a later Failed result gives
CommissioningFailed, a changed plan givesPlanChanged, and expiry or an identity change givesEvidenceExpiredorIdentityChanged. The allocator callsOffer/Evaluateon live inputs and does not read the stored conditions, so a stale status cannot make a server allocatable; it can only mislead a reader of the status until the nextProjectAllpass. - RBAC in
config/standalone/rbac.yamlnarrows the provider writer (it losesmachinecapacities/status) and adds one account per duty: projector, plan author, plan approver and operator. The author cannot approve and the approver cannot create plans. Thecapacity-projectorrole is read-only apart fromupdateStatus. - Agree with kevwilliams on the cutover: after rollout every existing capacity reads Prepared=False NotCommissioned, which fails closed, but
config/README.mdnever says why step 8 (fresh allocation) fails. Add steps to create the plan, the approval and one commissioning per synthetic device, with the approver and operator identities.
Follow-ups:
- The new
fleet-standalone-smoke-devicesClusterRoleBinding gives the smoke account cluster-wide Device read. Scope it to the provider namespace if the smoke does not need the duplicate scan. - The projector reads Devices in every namespace for duplicate detection (the comment says why). Record that this is a deliberate widening in the role description too.
- Add a test that a commissioning which regresses after a pass (new failed run, or plan replaced) flips the next
Offerto false without a projector pass. - This PR is based on
feat/device-commissioning-redfish, so it merges only after #196 does.
Kubernetes RBAC cannot grant write on one spec field, so the capacity operator could have dropped the block in a write that offers or withdraws. Admission now rejects any add, change, or removal of the supply hold part from a caller without its own permission. Removal entries are stamped from the caller like the other identity fields, and removing the block while a check is open is refused. The text now says where it relies on behavior only proposed in #200 and #201, and the summary example uses the API group that exists on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The simulator and the local VM site gain DeviceCommissioning workers, and the multi-plane sites register them alongside the Redfish one. A synthetic target has no BMC, so both compare the hardware and firmware the site enrolls for the Device with the plan. The simulator records one burn-in step. The local VM boots the site image once in burn-in mode on a scratch disk, reads its one result by receipt and removes the disk. The base site enrollment describes its synthetic Device's hardware so a commissioning can inspect it. Nothing creates a commissioning until the coordinator and allocator use commissioning evidence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The capacity projector now writes Prepared, Healthy, Available and the hardware of every MachineCapacity, from the Device's latest commissioning under its current plan, discovery, custody, the cleaning policy resolver and duplicate identities. It runs in the coordinator loop with its own identity in every mode, and the Metal controller role no longer writes capacity status. It re-reads the current plan each pass, so a plan revoked after admission makes nothing Prepared. Capacity counts its Device only while the Device is the incarnation registration recorded, never backs a Device without a hardware ID (#131), and needs evidence naming the current plan's name, generation, digest and approval. Serials compare without surrounding space on either side. The allocator no longer reads conditions: it evaluates each candidate from live evidence and pins the hardware commissioning inspected, so an edited status cannot make a server allocatable. It reads a candidate's Device and custody first and evaluates only identified, visibly free capacity. One allocation pass, like one projector pass, lists Devices, plans, approvals and commissionings once instead of once per capacity. A capacity whose reads or evaluation fail is skipped, and the error is returned only when nothing is offered. Every identity that evaluates capacity lists Devices project-wide in every mode, which a test pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every mode commissions its servers instead of writing fixture conditions. The standalone smoke and both multi-plane runs commission as a plan author, an approver and an operator before allocating. The multi-plane runs open a dispatch window for the commissioning with one source revision and close it with the next, so the install is still delivered before any worker Job, and the install scenarios count only the other assignments. The Redfish run's plan requires the lab's firmware inventory. kro recreates the finished commissioning's Job later in the run. In Redfish mode the BMC audit, boot count and receipts prove that replay sent nothing. In local VM mode a new commission-mark phase records digests of the commissioning's journal and boot record, and the evidence phase requires both unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After rollout every synthetic capacity reads Prepared=False NotCommissioned, so the cutover's "verify a fresh allocation" failed with insufficient capacity and the runbook never said why. Add the commissioning steps in order: three identities with the author and approver two different people, the plan, its approval, hardware and firmware in the site enrollment, one commissioning per Device, the wait for Prepared and Available, and only then the allocation check. The approval and the commissioning must match the stored plan exactly, so a small hack/commissioning-request command prints them from the objects the API server returns, with a test that its output is what custody computes. Say why the smoke's Device read and the capacity projector's are cluster-wide: the duplicate identity scan reads every namespace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A commissioning that regresses after a pass, by a new run that fails or a plan that replaces the one it passed under, must withdraw the next offer before any projector pass rewrites status. The test stops the projector, regresses the Device, and checks that the written status still says Available while Offer and the allocator refuse the server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b7ceaad to
54d9276
Compare
f349fc5 to
1d08a2b
Compare
kevwilliams
left a comment
There was a problem hiding this comment.
The cutover now defers the allocation check until each synthetic Device is commissioned, and walks through role bindings, plan, two-person approval, enrollment hardware and commissioning.
|
Thanks, both. Kevin approved b852ef5/1d08a2ba. Here is the delta for Evan's follow-ups:
Follow-up, not in this PR: the local VM commissioning worker still times burn-in from VM start to the journaled verdict. It's a test-environment worker, and production sites use the Redfish worker fixed in #196. |
ecv
left a comment
There was a problem hiding this comment.
Approve.
The cutover gap is closed and three of the four follow-ups are done. I compared the PR's own commits (dbfdfc4, 0fca357, f0cb8b7, b852ef5, 1d08a2b); the old head is no longer fetchable.
- Agree with kevwilliams on the cutover, fixed:
config/README.mdnow has a "Commissioning the synthetic Devices" section. It says why the capacities readNotCommissionedand allocation fails until they are commissioned. It then walks through the role bindings, plan, two-person approval (hack/commissioning-requestbuilds the approval), enrollment hardware, one commissioning per Device and the wait forPreparedandAvailable. The fresh-allocation step now waits for that. - Regression test, fixed: 1d08a2b adds a test that a regressed offer is withdrawn live, without a projector pass.
- Projector widening, fixed: the
capacity-projectorrole description says it reads Devices in every namespace deliberately, so a duplicate identity elsewhere withdraws the offer. - Smoke account binding, not fixed:
fleet-standalone-smoke-devicesstill gives the smoke account cluster-wide Device read through the coordinator Devices ClusterRole. Still a follow-up, not a hold. - Nothing in the new fix commits weakened the fail-closed default: capacity stays Prepared=False until commissioning passes.
- CI is green, including standalone-smoke on this head.
Follow-ups:
- Scope the smoke account's Device read to the provider namespace if the smoke does not need the duplicate scan.
- This PR is based on
feat/device-commissioning-redfish, so it merges only after #196 does.
Related to #185 and #131. Stacked on #196.
Whether a server can be allocated now comes only from evidence: its latest commissioning under the current plan, discovery and custody. The allocator evaluates that evidence itself, so editing status cannot make a server allocatable, and a server recorded without a hardware ID is never offered (#131). Every mode, both multi-plane runs included, commissions its servers before it allocates. Nothing ships until the stack reaches the feature branch.
An environment moving from the old synthetic staging must commission its Devices before the first allocation. The cutover steps in the config README give the order, with example manifests, and
hack/commissioning-requestprints the approval and each commissioning from the stored plan and Device, since both must match them exactly.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