feat(clusters): add force param to cluster purge endpoint - #345
Merged
Conversation
DELETE /v1/clusters/uid/{uid}?force=true skips the 10-minute
recent-activity guard. Intended for controlled decommissioning where the
caller has already verified the cluster's agents are stopped: the guard
also counts heartbeats from external reporters (management plane), which
keep refreshing lastobserved while a cluster is being torn down and can
delay a legitimate purge by 10-30 minutes.
Access is unchanged: the endpoint still requires ror global delete.
A forced purge that skips the guard logs a warning with both report
timestamps for auditability.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an optional
forcequery param toDELETE /v1/clusters/uid/{uid}.?force=trueskips the 10-minute recent-activity guard inPurgeClusterByUid. Default behavior (no param) is unchanged.Why
The guard treats any fresh heartbeat as "cluster is alive" — but heartbeats also come from management-plane reporters outside the guest cluster, which keep refreshing
lastobservedwhile a cluster is deliberately being decommissioned. With a ~15 min reporter cadence vs the 10 min threshold, a legitimate purge is blocked for 10–30 minutes waiting for an inactivity window.Observed in practice while decommissioning 4 clusters (t-slettefest-888/444, d-wh-bgo-001, d-wh-osl-001) with pre-cleanup tooling that scales the ror agents to zero and verifies the pods are gone before purging — a stronger liveness check than the timestamp heuristic, yet the API still refused with 409 for up to ~29 minutes.
Safety
ror/globaldelete ACL check runs before the param is read —forcegrants nothing to callers who couldn't already purge.lastobserved, v2agentstatus.lastseen) for the audit trail.Notes
go test ./...passes.internal/docs/are intentionally not regenerated here — they are ~5k lines stale repo-wide and CI/release regenerate at build time. Suggest a separate housekeeping PR.lastseen) rather than external reporters'lastobserved? That would fix the semantics for all callers, andforcewould remain the explicit escape hatch.