Skip to content

feat: flag seat-release deletes so vk keeps the warm-wake snapshot - #27

Merged
CMGS merged 3 commits into
mainfrom
feat/flag-seat-release-deletes
Jul 31, 2026
Merged

feat: flag seat-release deletes so vk keeps the warm-wake snapshot#27
CMGS merged 3 commits into
mainfrom
feat/flag-seat-release-deletes

Conversation

@tonicmuroq

@tonicmuroq tonicmuroq commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

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: release frees the scheduling seat by deleting the pod once every VM's :hibernate snapshot 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 stashed hibernated-on-node at 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.

retain is fast today precisely because its pod is never deleted, so its snapshot is never GC'd. This gives release the same warm wake while still handing the seat back.

What

reconcileSuspendRelease patches vm.cocoonstack.io/keep-snapshot-on-delete onto 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 Suspending forever. So a failure logs at error level and the delete proceeds.

Test

  • TestSuspendReleaseFlagsKeepSnapshotBeforeDelete — a Delete interceptor 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.md step 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/-age needs 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.

tonicmuroq and others added 3 commits July 30, 2026 23:01
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.
@CMGS
CMGS merged commit e3f0037 into main Jul 31, 2026
2 checks passed
@CMGS
CMGS deleted the feat/flag-seat-release-deletes branch July 31, 2026 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants