Closed xing-yang closed 4 hours ago
We don’t receive any deletion messages regarding dynamically provisioned VolumeGroupSnapshots
with DeletionPolicy
set to Retain
, because we don’t add the finalizers to the VolumeGroupSnapshot
object.
We didn’t add the finalizer on purpose. See:
About the annotation...we already have the logic to add it, but we won’t trigger it unless we set the finalizer:
This works for VolumeSnapshots because we always have the [snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection](http://snapshot.storage.kubernetes.io/volumesnapshot-as-source-protection)
finalizer:
https://github.com/kubernetes-csi/external-snapshotter/blob/4183faa057cc0e2f09e0b59bb5189893c10013e3/pkg/utils/util.go#L531-L534
What behavior should we have? Should we fix both VolumeSnapshots and VolumeGroupSnapshots?
Thanks!
cc: @xing-yang
I couldn't remember why condition 3 was there. I don't want to make changes in VolumeSnapshot since it has been working. Let's drop condition 3 from VolumeGroupSnapshot and add the bound finalizer on VolumeGroupSnapshot for both Delete
and Retain
.
What happened: When trying to delete a VolumeGroupSnapshotContent with Retain Deletion Policy after its VolumeGroupSnapshot is already deleted, I noticed that it is hanging because there is still finalizer on it.
We need to add the annotation
groupsnapshot.storage.kubernetes.io/volumegroupsnapshot-being-deleted: yes
on VolumeGroupSnapshotContent when VolumeGroupSnapshot is being deleted.We actually have a check in shouldDeleteGroupSnapshotContent() in the sidecar that checks if this annotation is present and if so, allow the VolumeGroupSnapshotContent to be deleted.
https://github.com/kubernetes-csi/external-snapshotter/blob/master/pkg/sidecar-controller/groupsnapshot_helper.go#L351
Note that we have similar logic that adds
snapshot.storage.kubernetes.io/volumesnapshot-being-deleted: "yes"
annotation on the VolumeSnapshotContent.What you expected to happen:
How to reproduce it:
Anything else we need to know?:
Environment:
kubectl version
):uname -a
):