snapscheduler icon indicating copy to clipboard operation
snapscheduler copied to clipboard

Actively used VolumeSnapshots being deleted due to retention violation

Open Chase-Marino opened this issue 1 year ago • 2 comments

Describe the bug When restoring to a VolumeSnapshot created by SnapshotScheduler which has retention defined, you are subject to your VolumeSnapshot being deleted. This results in the PVC having a dangling reference.

Steps to reproduce

  1. Create a snapshot schedule with retention time/count defined.
  2. Create PVC referencing VolumeSnapshot created by schedule
  3. Wait for retention cycle
  4. Observe the actively used VolumeSnapshot is deleted

Expected behavior VolumeSnapshot should be protected/excluded from retention once it has been referenced.

Actual results VolumeSnapshot is deleted

Additional context Current workaround is to delete snapscheduler.backube/when, snapscheduler.backube/schedule labels.

Solution ideas are for operator to detect when it was mounted and permanently exclude that Snapshot, or for a snapscheduler.backube/retention="keep" label to exclude a Snapshot from retention cleanup

Chase-Marino avatar Jun 11 '24 23:06 Chase-Marino

@JohnStrunk Thoughts?

Chase-Marino avatar Jun 14 '24 14:06 Chase-Marino

I'm a bit confused about what you believe the problem to be with the current behavior.

When the snapshot name is used in the dataSource field for a PVC, it serves to set the initial contents of the PVC, but once that PVC has been provisioned, the value of the field is meaningless. Why do you believe the associated snapshot should be retained?

BTW, removing snapscheduler.backube/schedule is the correct approach if you want to retain the snapshot.

JohnStrunk avatar Jun 14 '24 18:06 JohnStrunk