Repository navigation
feat: Run Machine allocation and release through Device custody - #182
Conversation
- MachineAllocation now holds an allocation's private facts: the exact Machine and Device incarnations, the accepted class, profile, CPU and memory, the hardware snapshot, the authority, the quota claim, the pinned cleaning policy digest, and the boot interface and target disks. The spec stays immutable; status carries the phase and the latest wipe. - The new allocator names each allocation from its Machine UID within the consumer project and writes quota claim, then allocation, then custody. An allocation whose Device another holder took is deleted before it ever held it, and the allocator selects again. - Installations become DeviceInstallations named from the allocation and the Installation UID. Bootstrap stays refused. - Release moves the holder to Release, closes each gate with evidence, wipes through DeviceWipe, and marks the allocation Released only after custody returns the Device. - The delivery package builds assignments from custody, delivers them to the sites serving each Device, and reports their results. Its loop is the coordinator process. - The simulator site gets an HTTP API, an access type, install and wipe workers whose simulated server lives in the fenced site store, and fixture discovery for its synthetic Devices. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The simulator is now a site: it serves the site API over the fenced site store, runs the simulator's install and wipe workers, and writes fixture discovery for the one Device it serves. - A custody coordinator Deployment reconciles custody, delivers admitted operations to the simulator site and reports their results. - Smoke phases act as the Metal provider and, on release, the release controller, each with its own ServiceAccount. A ValidatingAdmissionPolicy enforces the creator rule, as the creator webhook does in Milo. - The smoke checks that custody decided the contention, that power comes from the projector, that release wiped the Device once above every installation fence, and that custody names the reusing allocation. - The manager's power projector is the only writer of Machine power: it reports Unknown while a recovery hold exists or custody is unverified. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The staging handler allocates and releases through the allocator. Its Machine status keeps power, which the manager's power projector now writes from the custody of the Machine's allocation. - The fleet-manager runs the custody coordinator loop and fixture discovery for the synthetic site's Devices under its leader lease. The synthetic provider is the simulator site. The coordinator and the release controller authenticate with their own tokens; the manager's identity is the Metal provider. - config/milo now includes the device operations component, and the registration server serves the creator webhook. config/milo-synthetic includes the kinds, ProtectedResources and roles without the webhook, as it installs no registration webhook. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The federation handoff now carries one site assignment, or a request for a Device's fence report. The hub side is a delivery site: it delivers assignments, reads fresh fence reports, accepts a result only when the reflected observation is this cell's, for exactly the assignment the handoff carries, and marks it answered. The cell's worker runs one assignment through the site runner; its observer is the only status writer and reports what the site store holds. - The local VM workers port the old executor's stages onto the fenced journal: an exclusive disk, an installer boot proven by one console receipt and, in PXE mode, the boot server's deliveries and the DHCP lease, then a disk boot. A boot is started once and observed after a crash. The boot server serves only an open admission at the Device's stored fence. A wipe deletes every installation disk of the Device. - Fixture access and discovery for synthetic Devices move into their own package, shared by the simulator and local VM sites. - The staging tests run on custody, with the simulator site and the coordinator loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The phases allocate, install and release through the allocator against the provider Milo project. A coordinator command runs the custody loop with the Karmada hub as the one site, and fixture discovery under its own identity. Seeding creates one Device for each Device the cell enrolls. - The cell's worker runs its assignment through the site runner with the local VM workers, or the Redfish workers and the BMC's own per-Device credential; the shared credential is gone. The observer is the only status writer and deletes results the coordinator answered. The boot servers read admissions from the site store. - The Redfish executor and its journal are deleted; its enrollment, keyed by Device, stays. The lab BMC serves TLS with a key generated per run. - The handoff CRD carries the assignment or a fence report request, and the private custody namespace on the host is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…or process - The provider project gets the inventory and custody CRDs and one token each for the custody coordinator, the release controller and fixture discovery, with narrow roles. The CRD rule check runs in its own namespace, which the coordinator never reads. - Redfish enrollment generates the lab BMC's TLS key per run and writes one credential Secret per Device, carrying that key's digest as the approved pin. - The coordinator runs as a workstation process for the whole run, started after seeding and stopped before the clusters. - Site results carry lowercase JSON fields and their evidence as JSON. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- The old coordinator, its private Secret records, and their RBAC, namespace, admission policy and manager plumbing are gone: the private record cache, indexes, mappers and the unwired Milo lifecycle. The manager no longer takes --private-namespace. Quota claims now wake their Machine through the claim's Machine UID label. - The executor client, the simulator store, the local VM executor and their journals are gone; the site framework's workers replace them. The single-plane local VM harness is retired: the multi-plane local VM mode runs the same workers through the federation path. - Fleet's Milo quota claim is named from the Machine UID within its consumer project and implements the allocator's quota interface; release deletes it and waits until it is gone. - Synchronized DHCP reservations return on the site store: the boot server serves the feed from open admissions at the Device's stored fence, and a synced worker waits for the applied reservation before a network boot and for its withdrawal before it reports. - Fixture discovery's refresh loop moves into the fixture package, keeping the manager free of timers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Steps and evidence read the site store's per-Device journal and results, the handoff's assignment and reflected observation, and the provider project's custody, operations and allocations, in place of the old journal, request JSON and private records. - Delivery faults derive the duplicate, wrong-cell and stale-fence handoffs from a delivered assignment; the stale one must be refused by the worker with nothing stored. - The Redfish lost-response step replaces the worker while the BMC still withholds the On response, so recovery observes the boot instead of sending it again. Reflection faults forge each wrong observation against an unanswered handoff. - Evidence requires strictly increasing fences across installs and wipes and both allocations Released with custody back to None. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Device custody docs record Increment C: allocation and release on custody, the MachineAllocation record, the site types, the federation handoff, the coordinator in each mode, the power projector, and each decision with its reason. The two multi-plane runs are marked pending until they pass. - Operations guides describe the site store, per-Device Redfish credentials, the TLS lab BMC and the coordinator process. The single-plane local VM harness is marked retired. - config/README.md lists what synthetic staging now needs: re-imported records, two component credentials and the site enrollment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Once the coordinator accepts a result it labels the handoff answered and the cell deletes its copy, so the graph lifecycle step reads the provider project's operation for an answered handoff instead of the cell's cleared observation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Machine reserves its quota claim before its allocation exists. If it was deleted while still waiting for capacity, or a crash fell between the two writes, release found no allocation and never released the claim. The quota interface now releases by the Machine alone, and release starts from the Machine: with no allocation it releases the claim by the Machine's name for it. Tests cover that window, releasing an allocation that never held its Device without touching custody, and a wipe that keeps failing getting new steps up to the bound and then stopping with the Cleaning gate open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The power projector ran only on Machine events, so a recovery hold or a discovered power change after the last Machine event left status.power stale. Custody, MachineAllocation and Device events in the provider project now wake the consumer's Machines through the provider event route. A test covers On, Unknown under a hold and with unverified custody, and no power after release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- A local VM installation whose network boot fails closes its boot admission at once, so the boot server stops serving the installer for the rest of the window. A worker stopped from outside leaves it open for its replacement. - The site API has its own test: token rejection, a redelivery that runs once, the fence report, a forgotten result, and an invalid assignment. - The Metal provider's role may delete an allocation that lost its Device before it held it. config/README.md lists the roles the staging manager's own identity needs and the old private namespace to delete by hand. - device-custody.md records the per-site credential list, the observer's writable mount and staging's one-process seam as decisions. - .gitignore lists every command binary built at the repository root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The release phase deleted the consumer's Machine first, which the management identity may not do, so every attempt was refused and retried silently until the phase timed out. The acceptance releases a Machine that still exists, as the old phase did, and publishes it Released. Each phase now prints every new reason it is waiting, so a phase that times out shows what it waited for. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Redfish worker could list every BMC credential Secret at its site and chose its Device's in code. A Device's credential Secret is now named from the Device, the coordinator writes that name into the operation's handoff, and kro grants the operation's worker get on exactly that Secret, with no list or watch. The worker refuses a handoff that names another Secret, and reads its credential with one direct get, still checked against the discovery contract and its approved pin. Admission lets kro create a credential Role only of that shape, and kro itself holds get, not list. The site test proves a lookup works through a reader that refuses every list and rejects another Device's, project's or name's Secret. The transport test refuses a handoff naming another Device's credential. The multi-plane worker-rbac phase proves a worker can get its own Device's credential and is denied another Device's, listing and watching. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The boot-denials probe parsed the boot server's configuration and failed in the runtime Pod, which carries no boot origin. The probe needs only the site store's admissions and the listener it is given, so it reads nothing else. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In Redfish mode the boot service parsed the worker's enrollment and console configuration, which its Deployment does not carry, and crashed at start. It now reads only the artifacts, the boot listener and the evidence path; only the DHCP feed also reads the enrollment, for each Device's provisioning address. The probe's flag and origin error no longer name the environment variable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kro now holds only get on the site's credential Secrets, so it cannot grant list: RBAC escalation refuses a listing credential Role before admission runs. The kro RBAC phase expects that layer for that shape and the admission policies for every shape within kro's grant. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lab BMC serves both targets with one TLS key, so seeding target B as a Device made custody refuse the installation as a shared key. Target B stays enrolled at the site with its own credential, so the isolation, boot-denial and worker credential checks still cover it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Redfish worker's Role names its Device's credential Secret from the handoff, so a wrong-cell or stale-fence fault handoff without one rendered no Job and the delivery-faults phase timed out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c55ba8b to
336a266
Compare
|
Rebased onto #180's fix at 9885927. The new head is 336a266. The fix makes a same-fence copy that waited for the run lock return the stored result instead of running again. C's 21 commits replayed with no conflicts and no content change, and every caller of the site runner handles the returned result. At this head the 17 offline checks, the standalone smoke, the multi-plane preflight and both multi-plane acceptance runs, local VM and Redfish, pass. A fresh re-review approved this exact head. The body now also records that BMC discovery's Role still reads every Secret in its namespace, so discovery must stay in a namespace that holds only BMC credentials. |
The smoke now renders the Metal, inventory and Device custody CRDs together before any fixture, but the preflight test's fake kustomize knew only the Metal build and failed. It now serves all three builds, and the CRD apply requires each of them, so the test still fails if a fixture is applied before every CRD is Established or a CRD set is dropped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A handoff whose spec.device differed from its assignment's Device still got a credential Role, on the assignment Device's Secret, before its worker refused it. The Redfish graph now grants credential Roles and bindings only to handoffs whose Device is their assignment's. Any other gets no grant, and its worker refuses it. The delivery-faults phase adds such a handoff and checks that it gets no Role. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
New head 58a8232 closes one more gap in the credential grant. A handoff whose The site decodes the assignment with Go's JSON decoder, and kro uses its own One limit remains. A handoff whose assignment is not valid JSON makes kro's expression fail for the whole graph, so no new grants or Jobs are made until that handoff is deleted. Only the coordinator writes handoffs, and it always writes valid JSON. The same was true when the Role read the assignment before this change. At 58a8232:
|
ecv
left a comment
There was a problem hiding this comment.
Approve.
Both holds from 75cae50 are resolved at 58a8232.
- Incarnation guard:
TestARecreatedDeviceIsNeverClaimedUnderItsStaleLabelbuilds exactly the missing state (custody still labelled with the old UID, Device recreated, claim under the old UID) and expects ErrUnavailable, so thedevice.UID != deviceUIDcase is now the only thing that refuses it. - Credential isolation: the handoff no longer carries a credential name. The graph derives the Role's
resourceNamesfrom the assignment's own Device with the samesha256-hex-20 rule assite.CredentialSecretName, and renders a Role only for handoffs whosespec.devicematches the assignment's. A forgedspec.credentialis now an unknown field the API refuses, and the fault harness asserts both that and that no Role ever names the other Device's Secret.hash.sha256is in kro's CEL library at the pinned v0.9.4.
Follow-ups:
- The new device-mismatch and foreign-credential faults run only in the multi-plane Redfish lab, not CI. Record the lab run at this head before anything outside staging relies on them.
- Synthetic staging still has no run, and merging moves staging at once, so run its manual steps in order right after merge.
…ent certificates Synthetic staging gave the custody coordinator and the release controller a bearer token each, but staging's Milo identities sign in with client certificates, so the manager could not start there. Each now takes a directory holding a cert-manager Certificate's tls.crt and tls.key. Its connection keeps the manager's Milo endpoint and server CA and drops the manager's own credentials. client-go rereads the files, so a renewal needs no restart. The overlay mounts fleet-custody-coordinator-client-cert and fleet-release-controller-client-cert whole. The staging steps no longer re-import records GitOps manages, and add deleting the publisher's copy of the MachineClass, whose immutable source still names the old project field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c343885 to
7c01eba
Compare
|
New head 7c01eba adds one commit on top of 58a8232, which you approved. Without it, merging would deploy a manager that cannot start in staging. What was missing. Staging's Milo identities sign in with client certificates, issued by cert-manager. The custody coordinator and the release controller only had a bearer-token path ( What changed.
Staging steps.
At 7c01eba:
|
ecv
left a comment
There was a problem hiding this comment.
Approve.
The delta since 58a8232 switches the custody coordinator and the release controller in synthetic staging from bearer tokens to client certificates, which is what staging's Milo identities sign in with. Without it the manager could not start there. Checks green at 7c01eba.
withClientCertstarts fromrest.AnonymousClientConfig, which keeps the endpoint and server CA and strips the manager's token, exec plugin and certificate data. Each component then authenticates only with its own certificate. The new test proves this against a server that requires a client certificate: it sees the coordinator's certificate and no Authorization header.- A missing or unreadable certificate now fails at startup, naming the component.
- The Secrets are mounted as volumes with
items, notsubPath, so a renewed certificate reaches the files that client-go rereads. - The staging steps now cover the new identities and deleting the publisher's MachineClass copy, whose source is immutable.
Some credentials, such as client certificates, carry a username but no UID. The manager refused them at startup, so an environment whose client certificates carry no UID could not run the Metal provider or the release controller. A caller is now identified by username, as Kubernetes RBAC identifies it. The creator records the UID only when the credential carries one, the creator webhook requires spec.creator.uid to equal the caller's UID (unset when the caller has none), and the CRDs make creator.uid optional. Principal classification is unchanged: a configured UID must match, and a principal without one matches the username alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The standalone ValidatingAdmissionPolicy still compared spec.creator.uid with the caller's UID unconditionally. For a caller whose credential carries no UID the field is absent, the expression errors, and the fail-closed policy refused every create, so standalone disagreed with the creator webhook. The policy now reads both UIDs with has() and requires them to be equal, unset on both sides when the caller has none. A test against a real API server applies the packaged policy and covers callers with and without a UID. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ecv
left a comment
There was a problem hiding this comment.
Approve.
The delta since 7c01eba lets a credential without a UID, such as a client certificate, act as a custody principal and operation creator. Without it the manager refuses to start where client certificates carry no UID.
- A caller that does carry a UID is still bound to it: the creator webhook compares
creator.UIDwithrequest.UserInfo.UIDunconditionally, so a UID-bearing caller cannot leave it unset, and a caller without one cannot set it. - The standalone ValidatingAdmissionPolicy now matches the webhook. Its
has()guards stop the expression erroring when no UID is present, which made the fail-closed policy refuse every create. The new envtest applies the packaged policy against a real API server, for callers with and without a UID. creator.uidis dropped from the CRDrequiredlists andomitemptyin the Go type, so stored objects and new writes agree.
Follow-ups:
- A principal configured without a UID now matches on username alone. A username that is deleted and later reissued to someone else would inherit that principal's standing and any operation recorded under it. Configure UIDs wherever the identity provider issues them, and say in the custody doc that username-only principals rely on usernames never being reused.
The commissioning kinds were written before #182 removed object UIDs from every spec. Their schemas still required a Device UID in the device reference and a UID in every creator, so nothing could create a commissioning, plan or approval against the current types. The three schemas now match the other operation kinds. The device reference holds only a name, the Device incarnation is the device-uid label, a creator's UID is optional, and a commissioning's status records the admission fence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t claimed Before the rebase onto #182, a Device recreated under the same name between the allocator's last check and its custody claim was not caught, because the claim took only the Device name. The claim now takes the incarnation from the allocation's device-uid label and refuses unless the live Device and custody both name it. The test recreates the Device right after the allocator's last check read it, so that check passes and only the claim can refuse. The allocation is withdrawn, the allocator selects the other server, and the recreated Device stays unclaimed. Removing the claim's incarnation check fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commissioning kinds were written before #182 removed object UIDs from every spec. Their schemas still required a Device UID in the device reference and a UID in every creator, so nothing could create a commissioning, plan or approval against the current types. The three schemas now match the other operation kinds. The device reference holds only a name, the Device incarnation is the device-uid label, a creator's UID is optional, and a commissioning's status records the admission fence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t claimed Before the rebase onto #182, a Device recreated under the same name between the allocator's last check and its custody claim was not caught, because the claim took only the Device name. The claim now takes the incarnation from the allocation's device-uid label and refuses unless the live Device and custody both name it. The test recreates the Device right after the allocator's last check read it, so that check passes and only the claim can refuse. The allocation is withdrawn, the allocator selects the other server, and the recreated Device stays unclaimed. Removing the claim's incarnation check fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The commissioning kinds were written before #182 removed object UIDs from every spec. Their schemas still required a Device UID in the device reference and a UID in every creator, so nothing could create a commissioning, plan or approval against the current types. The three schemas now match the other operation kinds. The device reference holds only a name, the Device incarnation is the device-uid label, a creator's UID is optional, and a commissioning's status records the admission fence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t claimed Before the rebase onto #182, a Device recreated under the same name between the allocator's last check and its custody claim was not caught, because the claim took only the Device name. The claim now takes the incarnation from the allocation's device-uid label and refuses unless the live Device and custody both name it. The test recreates the Device right after the allocator's last check read it, so that check passes and only the claim can refuse. The allocation is withdrawn, the allocator selects the other server, and the recreated Device stays unclaimed. Removing the claim's incarnation check fails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Machine allocation and release still ran on the old Secret-backed records, so the custody and site framework from the earlier increments never decided anything.
This change moves allocation, installation and release onto custody and the site framework in both the standalone and multi-plane modes, and deletes the old records, journals, payload and shared credential with no compatibility code.
The manager's power projector becomes the only writer of Machine power, which reads Unknown while a hold exists.
Service identities are identified by username, as Kubernetes RBAC identifies them. An operation's creator records the caller's UID only when its credential carries one, because client certificates carry none. A configured principal with a UID must match it; one without matches the username alone.
Decisions for a person
This needs a person's review before merge.
Test plan
Related to #174
🤖 Generated with Claude Code