Skip to content

feat(clone): reap the internal snapshot a clone took on its source - #200

Draft
Andrei Kvapil (kvaps) wants to merge 1 commit into
fix/csi-clone-and-restore-idempotencyfrom
feat/clone-snapshot-reap
Draft

Andrei Kvapil (kvaps) wants to merge 1 commit into
fix/csi-clone-and-restore-idempotencyfrom
feat/clone-snapshot-reap

Conversation

@kvaps

Copy link
Copy Markdown
Member

Stacked on #190.

A clone of a source with volumes takes clone-<target> on the source, and nothing ever deleted it, so once a clone existed the source could never be deleted through the API, which refuses a definition that has snapshots. rd d of a clone now reaps that snapshot, on both the REST and the CLI door.

Ownership is a prop the clone path stamps, never the name, so an operator's snapshot called clone-<target> is never touched. A snapshot another definition was restored from is kept. The reap marks the snapshot, lists dependents past the cache, and only then deletes; a restore reads its snapshot back past the cache once its definition exists and withdraws on a live mark, on a delete in flight, or on a snapshot that is gone. Whichever of the list and the create comes second sees the other. The store now surfaces DELETE on a snapshot a satellite finalizer still holds, and the snapshot list no longer stamps SUCCESSFUL beside it. A later rd d of the source names what is left and why.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kvaps
Andrei Kvapil (kvaps) force-pushed the fix/csi-clone-and-restore-idempotency branch from 47acc58 to a4f876d Compare October 8, 2026 03:38
@kvaps
Andrei Kvapil (kvaps) force-pushed the feat/clone-snapshot-reap branch 2 times, most recently from 3275ac7 to f63a9f2 Compare October 8, 2026 08:43
@kvaps
Andrei Kvapil (kvaps) force-pushed the fix/csi-clone-and-restore-idempotency branch 2 times, most recently from 4ab3ffd to 5b23086 Compare October 8, 2026 12:28
@kvaps
Andrei Kvapil (kvaps) force-pushed the fix/csi-clone-and-restore-idempotency branch from 5b23086 to 597e7c8 Compare October 8, 2026 17:58
@kvaps
Andrei Kvapil (kvaps) force-pushed the fix/csi-clone-and-restore-idempotency branch from 597e7c8 to 3e5eede Compare October 8, 2026 20:15
@kvaps
Andrei Kvapil (kvaps) force-pushed the fix/csi-clone-and-restore-idempotency branch from 3e5eede to d77d76c Compare October 9, 2026 16:54
A clone of a source with volumes takes `clone-<target>` on the source
and restores from it, and nothing ever deleted that snapshot. Deleting
the clone left it behind, and the source could then never be deleted
again through the API, which refuses a definition that has snapshots.
Every CSI clone goes through this path.

`rd d` of a clone now reaps that snapshot, on both the REST and the
CLI door. Ownership is a prop the clone path stamps on the snapshot,
never its name, so an operator's snapshot called `clone-<target>` is
never touched.

The snapshot is visible in `s l`, so another definition can have been
restored from it, and that definition keeps reading it: new replicas
are pinned to its nodes and restored from it by name. A dependent
appears in two steps, the snapshot read and the definition create, so
no list on the reap's side alone can see one between them. The reap
marks the snapshot, then lists dependents past the cache, and only
then deletes; a restore creates its definition, then reads the
snapshot back past the cache and withdraws on a live mark, on a
snapshot whose delete is in flight, or on one that is gone. Whichever
of the list and the create comes second sees the other. A snapshot
the reap keeps has the mark taken off again.

The reap runs detached from its caller on a bounded budget, since the
delete has already been reported, and a mark left by a process that
died expires. A delete that was issued is read off the snapshot
itself: the store now surfaces DELETE on a snapshot a finalizer still
holds, the way it does for resources, and the snapshot list no longer
stamps SUCCESSFUL beside it.

A later `rd d` of the source names what is still there: a snapshot
safe to delete, one kept because a named definition restores from it,
and one that looks like a clone's but was never stamped.

Assisted-by: LLM
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps
Andrei Kvapil (kvaps) force-pushed the fix/csi-clone-and-restore-idempotency branch from d77d76c to 7a940cd Compare October 9, 2026 19:50
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.

1 participant