Repository navigation
Conversation
Remove the registration ledger and everything that served it: the Secret-backed CAS store, sealed segments, signed activation and expansion, the control ConfigMap and key, /activationz and /status, cmd/fleet-registration-control, the ledger retention policies and the ledger Secret RBAC. The webhook now keeps no state. A capacity create must be named device-<Device UID>, so the API server refuses a second capacity for the same Device. It is checked against the live Device, the caller's SARs, aliases on every live Device in the provider scope, and every existing capacity. The webhook fences capacity writes only; Device, namespace and Project writes no longer pass through it. The registration pod mounts no service account token. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add config/components/device-deletion-protection, a ValidatingAdmissionPolicy and binding that deny every Device DELETE with no exemptions. config/milo-production is config/milo plus the component. config/milo, config/milo-synthetic and every other root leave it out, so test and staging control planes can still delete Devices. The overlay isolation validator now fails when a production-style root lacks the component or any other root renders it. CI builds the new root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The registration form no longer asks for a capacity name. It shows device-<Device UID>, which is what admission now requires, and marks every Device that shares a normalized serial, system UUID or provider host reference with another Device as Conflicting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rewrite the stage-1 contract around the decision to drop the ledger and signed activation: live-Device checks, Device-derived capacity names, the documented duplicate race, and optional Device deletion protection, including deletecollection, namespace and project cascades, remediation and retirement. Remove the storage rollout runbook, which only described the ledger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add spec.lifecycle to Device with Active (the CRD default), Decommissioning and Retired. CRD transition rules on spec allow Active and Decommissioning to move between each other and Decommissioning to move to Retired. Active to Retired is rejected and nothing leaves Retired, including by removing the field, which defaults back to Active. Creation in any lifecycle is allowed. The CRD is hand-maintained YAML; this repository has no CRD generator, so the schema and its offline tests change together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Registration admits new capacity only for an Active Device. A capacity update that would leave Disabled while its Device is Decommissioning or Retired is denied for that reason, after checking that the caller can read the Device; every other update keeps the stage-1 denial. Retired Devices still take part in the duplicate-identity scan while they exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Production-specific configuration belongs to the deploying repository, so remove the config/milo-production root. The device-deletion-protection component stays as a reusable component that no root here includes. The policy now admits a Device DELETE only when namespaceObject has a deletion timestamp (null-guarded, so a missing namespace denies) or the deleted Device is Retired. Everything else is denied with a message to move the Device to Decommissioning, then Retired. It keeps failurePolicy Fail, Deny only, and no subject checks or exemptions. The overlay isolation validator renders the component on its own and requires that exact policy and binding, fails if any root here renders the policy under any name, and fails if the inventory component exists without the deletion component. Fixtures cover a root including the component and the policy renamed, audit-only, warn-only, fail-open, scoped, exempted or given a weaker rule. envtest applies the component and checks Active and Decommissioning deletes are denied, Retired deletes pass, deletecollection over mixed Devices denies the non-retired ones, and Devices of a deleting namespace can be deleted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The registration picker refuses Devices that are Decommissioning or Retired with an explicit reason, and still marks an Active Device that shares identity with a Retired one as conflicting. The inventory detail panel shows the lifecycle, defaulting to Active. The UI does not edit lifecycle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the lifecycle values and transitions, the registration rules, and the deletion policy's two exceptions. Deploying repositories opt into the component; this repository no longer has a production Milo root. Namespace deletion is the privileged escape hatch and now completes with its Devices. The earlier stays-Terminating remediation is removed. Record that pinned Milo project purge issues collection deletes in every namespace before marking any, and never deletes default, so a project that holds Devices that are not Retired does not finish purging while the component is installed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Milo project purge drains every namespace, default included, with DeleteCollection before it deletes any namespace, so the deleting-namespace exception never applies and a denied Device aborts the purge. Add a third exception: the request's username is listed exactly in the cleanupUsernames key of a ConfigMap parameter. The policy gains paramKind core/v1 ConfigMap. The shipped binding has no paramRef, so params is null and the exception is off; deploying repositories add the ConfigMap and a paramRef with parameterNotFoundAction Deny. Entries are trimmed, empty entries and an empty username never match, and groups, prefixes and wildcards are not consulted. failurePolicy Fail and validationActions Deny stay. The overlay validator requires the exact rendered policy, including paramKind, and rejects wildcard, prefix, group-based, null-params-allows-all, empty-username and always-true variants, a different or missing paramKind, and any paramRef in the component. Envtest on Kubernetes 1.37.0 covers the null-params binding, listed, unlisted, prefix and superset users, deletecollection, a Milo-style purge of default and another namespace, and fail-closed denial (422 Invalid) when the referenced ConfigMap is missing. An offline test runs the expression through the admission CEL compiler for an empty username. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document the third Device deletion exception, how a deploying repository enables it with a ConfigMap and a paramRef that sets parameterNotFoundAction Deny, and that a missing ConfigMap then denies every Device delete. Note that impersonating a listed identity grants the exemption. Project deletion now completes when the cleanup identity is configured and stays blocked otherwise, unless every Device is Retired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mark the cleanup identity exemption as a stopgap. Once Milo marks each namespace it purges, default included, before deleting its contents, the deletion policy can rely on the namespace signal alone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The capacity registration webhook matched every MachineCapacity create, update and delete, and every status write, in every namespace, and denied all but gated creates. That blocked synthetic capacity a GitOps controller re-applies, a synthetic provider's status writes, and hand-made capacity. The webhook now governs only inventory-backed capacity: capacity carrying a fleet.datumapis.com/registration-* annotation on the new or old object, or a create under the derived device- name. A match condition routes only those requests, so adding, changing or removing the marker is still denied. Status writes are no longer routed; the status subresource cannot change metadata or spec, so they cannot strip the marker or enable capacity. The handler allows unmarked requests without reading Devices. failurePolicy Fail, sideEffects None and the timeout are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Detail for review. The 13 commits run from Registration webhook (
Device lifecycle (
Deletion protection (
UI (
Open points
|
ecv
left a comment
There was a problem hiding this comment.
Request changes. Dropping the ledger is a real narrowing: no state writes, no Secret access, and it fails closed. But the tenancy guard has no test.
- The provider-project check (
!slices.Contains(handler.Projects, name)) is the only gate on which project a request is judged in. Resolve, the webhook matchConditions and the SubjectAccessReview take no project scope, and the SAR uses the request's own UserInfo. Disabling the check leaves every unit and envtest suite green at b3dc951. Add a test that a project outside--provider-projectsis denied before any Device read or SAR. - The
project.Identity.RouteName != namechecks are untested too: everyResolvestub returns a RouteName equal to the name asked for. Make one return a mismatch and assert denial. - Caller identity is still unchecked (#149). Any client certificate from the CA can post an AdmissionReview and read the verdict, which names Devices and their lifecycle. That makes the scope check the only thing limiting the oracle.
Follow-ups:
- The concurrent same-serial race is documented but not closed. Capacity stays Disabled, so allocation must not land before it is.
- A Device deleted after the check leaves orphan capacity unless the opt-in deletion policy is installed, and staging doesn't install it.
- Clusters that ran the ledger keep their
fleet-system-privateSecrets and ConfigMap after prune. Say whether to remove them by hand.
The provider-project check was the only gate on which project a request is judged in, yet disabling it left every suite green: each Resolve stub returned a fixed route, so the route check denied first. Likewise no stub returned a route other than the one asked for. Add unit and envtest cases with a Resolve that resolves any name, and project clients and SubjectAccessReviews that fail the test if they are reached. A project outside the scope is denied on create and on an enabling update before any of them run, and a mismatched route is denied on both paths before its client is used. Disabling the scope check or either route check now fails these tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
State that the provider-project scope check is the only limit on what a client certificate holder can learn until the webhook checks its caller (#149). State that allocation must not be enabled for inventory-backed capacity until the same-serial race is closed. Describe orphaned capacity: it stays Disabled and immutable, blocks a same-name replacement, and blocks every registration in the provider scope. Document re-recording the deleted machine as Retired under its old name, and pin that remediation in a unit test. List all three as stage-2 blockers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prune removes only what the ledger manifests applied. List the objects the ledger revisions created at runtime: the root Secret and sealed segment Secrets in fleet-system-private and the control ConfigMap in fleet-system. Say to remove them by hand, in which order, and not to delete the shared private namespace. Environments that never deployed the registration service have nothing to clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Each finding is addressed below. The commits are on this PR's head as 8b4e57d, 98e285f and b01ce48, and on 1. The provider-project check had no test. Fixed in 8b4e57d.
2. The
3. Caller identity (#149). Documented in 98e285f, with no code change. Follow-ups, all in
Checks run on both branches: |
ecv
left a comment
There was a problem hiding this comment.
Approve. The tenancy guards are now covered. At b01ce48, disabling the provider-project check fails TestOutOfScopeProjectIsDeniedBeforeAnyRead and TestWebhookJudgesOnlyTheConfiguredProject. Disabling either RouteName check fails TestResolvedRouteMismatchIsDenied and the same envtest. The delta is tests and docs only.
Follow-ups:
- #149 is still open: any client certificate from the CA can read verdicts for the configured projects.
- Last review's follow-ups still stand: the same-serial race, orphan capacity when a Device is deleted after the check, and leftover ledger Secrets after prune.
|
Closing as planned. This was a review-only view of commits already on feat/manual-inventory-records (#90), where the review fixes also landed. Open follow-ups: #149, the same-serial race, orphaned capacity after a Device is deleted, and leftover ledger objects (now documented). |
Capacity registration changes went onto the staging branch of #90 without review. This PR shows those 13 commits alone so they can be reviewed. Fixes go to that branch, and this PR closes instead of merging.
Registration now checks live Devices instead of keeping its own ledger, and signed activation is gone. Each Device backs at most one capacity, which stays Disabled. Devices gain a lifecycle, and environments can opt in to blocking Device deletion.
Known gaps: two Devices registered at the same moment with the same serial both succeed, caller identity is unchecked (#149), and allocation stays out of scope.
Details are in the first comment.
🤖 Generated with Claude Code