feat: flag seat-release deletes so vk keeps the warm-wake snapshot - #27
Merged
Conversation
A release-policy suspend deletes the pod to free its scheduling seat, but vk-cocoon read that as a teardown and GC'd the node-local snapshot — the one thing that lets the wake, which soft-prefers the same node at weight 100, skip the registry pull. Flag the pod just before the delete so vk keeps it as the warm-wake cache. The patch is best-effort by design: losing the flag costs the wake a registry pull (slower, still correct), whereas failing the reconcile on it would forfeit the seat this policy exists to free. A failure logs at error level and the delete proceeds. Bumps cocoon-common for the annotation and PatchKeepSnapshotOnDelete.
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.
Depends on cocoonstack/cocoon-common#14 (merged; pinned at its merge commit
v0.2.9-0.20260731042413-9ca4f1c8fc0f). Pairs with cocoonstack/vk-cocoon#61, which honors the flag.Why
hibernatePolicy: releasefrees the scheduling seat by deleting the pod once every VM's:hibernatesnapshot is registry-verified — that part works. But vk-cocoon could not tell that delete apart from a real teardown, so it GC'd the node-local snapshot. Wake then soft-prefers the stashedhibernated-on-nodeat weight 100 and often lands back on the right node, only to cold-pull state that had been sitting on that node's disk minutes earlier.retainis fast today precisely because its pod is never deleted, so its snapshot is never GC'd. This givesreleasethe same warm wake while still handing the seat back.What
reconcileSuspendReleasepatchesvm.cocoonstack.io/keep-snapshot-on-deleteonto each pod immediately before deleting it.The patch is best-effort by design. Losing the flag costs the wake a registry pull — slower, still correct. Failing the reconcile on it would forfeit the seat this policy exists to free, and a permanently rejected patch (say a webhook) would wedge the set in
Suspendingforever. So a failure logs at error level and the delete proceeds.Test
TestSuspendReleaseFlagsKeepSnapshotBeforeDelete— aDeleteinterceptor re-reads the pod from the API to prove the flag is durable before the delete lands, not merely set on the in-memory object.TestSuspendReleaseFreesSeatWhenFlagPatchFails— a patch rejection still releases the seat and does not fail the reconcile.go build ./...,go test ./...,make lint(linux + darwin) all green.Docs
docs/cocoonset.mdstep 7 now documents the release branch end to end — the stash, the flag, the delete, and the weight-100 preferred affinity on wake. The slot-release path was previously undocumented there.Follow-up (not in this PR)
Nothing reclaims a kept snapshot yet. Before this ships, node-level
cocoon gc --snapshot --snapshot-size/-ageneeds to bound the cache and vk's storage allocatable (read once at startup) needs to stop hiding it from the scheduler — otherwise this trades silent disk oversubscription for the memory oversubscription it enables.