Repository navigation
feat: mark pulled clone sources and reclaim them under any name - #121
Merged
Merged
Conversation
The reclaimer only looked at vk- names, so a clone source pulled from another repository (simular/osworld-ref:ref12, or a default-tag simular/golden) stayed on the node forever once no pod used it. A name alone cannot tell such a copy from a snapshot an operator imported by hand, which may exist nowhere else. vk-cocoon now imports every clone-source pull with the description "vk-cocoon clone source" (cocoon's snapshot import already takes one and snapshot list reports it). The reclaimer removes a marked snapshot once no pod on the node clones from it, whatever its name; the registry still holds it. Unmarked snapshots outside the vk- names are never touched, and the #120 colon rule stays for vk- copies pulled before the mark existed. Hibernate wake imports stay unmarked. docs/reconcile.md now describes both rules.
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.
Gap
The snapshot reclaimer only considers
vk-names. A clone source pulled from any other repository, such assimular/osworld-ref:ref12or a default-tagsimular/golden, is never reclaimed after the last pod stops cloning from it. The name alone cannot be trusted to widen the rule: an operator may have imported a local-only snapshot by hand under the same kind of name, and deleting it would lose data that exists nowhere else.Change
Puller.PullSnapshotandRuntime.SnapshotImporttake a description; the clone-source pull (ensureSnapshot) passesvk-cocoon clone source, andCocoonCLI.SnapshotImportforwards it ascocoon snapshot import --description(cocoon stores it andsnapshot listreports it). Hibernate wake imports pass none.vm.SnapshotgainsDescription.vk-names are never touched. The colon rule from fix: reclaim clone-source copies no pod on the node clones from #120 stays forvk-copies pulled before the mark existed.docs/reconcile.mddescribes the reclaimer's rules, including fix: reclaim clone-source copies no pod on the node clones from #120's, which it had not yet.Tests
TestTheReclaimerDropsMarkedCloneSourcesUnderAnyName: a markedsimular/osworld-ref:ref12no pod uses is removed (fails on main:removed [], want [...]); marked and in use is kept; the same name unmarked and an unmarked default-tag name are kept. The registry double cannot answer, so the removal cannot depend on it.ensureSnapshottest now also asserts the single import carried the clone-source mark.TestSnapshotImportPassesTheDescriptionOnlyWhenSet: the CLI argv omits--descriptionwhen empty and carries it when set (fake cocoon binary via the ForkLock helper from test: write fake cocoon binaries under ForkLock #119).Gates
make lint0 issues on linux and darwin,make fmt-checkclean,asl ./...clean on both GOOS,go test -race ./...green (GOWORK=off); the three touched packages also pass three race runs on Linux. Not yet run on hardware. Hot path: none; one extra argv pair per clone-source pull.