Repository navigation
feat(quota): Hold each Machine's quota claim until release - #189
Conversation
13eb67f to
3009922
Compare
adf1c21 to
bf7dc2c
Compare
Create the Milo quota claim with Fleet's quota custody finalizer. Milo keeps counting a deleting claim while a finalizer holds it, so a claim deleted by another actor or by namespace purge keeps its quota until Fleet releases it. Release deletes the claim, then removes the finalizer with a conditional update, and reports the quota free only once the claim is gone. Acquire restores a finalizer removed from a live claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Release removes only Fleet's finalizer and stays pending while another actor still holds the claim, because Milo still counts it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recreate a Machine with the same project, namespace and name. It gets its own claim and cannot acquire or release the predecessor's granted claim, because the claim name hashes the Machine UID and the machine-uid label must match. The test fails when either guard is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
State the finalizer, its release order and the acknowledgment once, in the quota claim section, and drop the overview paragraph that repeated it. Say that Milo still supplies neither a custody anchor nor an acknowledgment and does not protect Fleet's finalizer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bd768df to
6878d13
Compare
bf7dc2c to
7aad3d3
Compare
ecv
left a comment
There was a problem hiding this comment.
Approve.
New claims carry fleet.datumapis.com/quota-custody. Acquire restores the finalizer on a live claim that lost it before trusting the grant. Release deletes on a UID precondition, then on a later pass drops only its own finalizer from the deleting claim, on the version read, and leaves other finalizers alone. A claim that someone else deletes keeps counting until Fleet releases it. The tests cover external deletion, a removed finalizer, another actor's finalizer and release ordering.
Releasenow needsupdateon ResourceClaims to drop the finalizer. No role in this repository grants the manager's Milo identity ResourceClaim permissions, so I could not check it holdsupdate. Without it, every released Machine's claim stays deleting and counted, and the project's Machine quota leaks one per release. Confirm the grant, or run the deferred multiplane acceptance, before this reaches a deployment.- Claims created before this change have no finalizer. A live one gains it on its next
Acquire. One released before that is deleted at once, as it is today.
Follow-ups:
- As the PR says, anyone with claim update permission can remove the finalizer during deletion and free the quota early. Worth an issue against Milo for service-owned finalizers, since the custody proposal (#187) depends on it.
|
@ecv Thanks for the approval. Staging deploys from the merge branch, so I’m holding this until the deployment permission is confirmed. I verified the manager’s configured project identity, but my Milo account cannot submit a SubjectAccessReview on the consumer-project route. That denial is for my query, not for Fleet. A platform operator with review privileges can unblock this by confirming |
Summary
Fleet adds a finalizer to each Machine quota claim so Milo continues counting a deleting claim while hardware cleanup is pending. Fleet removes its own finalizer when it releases the claim and leaves other actors’ finalizers intact. This implements the quota custody portion of the production admission proposal following #188.
Scope
Fleet restores a missing finalizer on a live claim. Milo does not protect service finalizers from identities with claim update permission, so this does not prevent an authorized updater from removing the finalizer during deletion.
Verification
Quota tests cover external deletion, a removed Fleet finalizer, preservation of another actor’s finalizer, and release ordering. Multiplane acceptance is deferred until the staging stack lands.