Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to delete a VolumeSnapshot if it's corresponding VolumeSnapshotContent updates deletion policy from Delete to Retain #292

Closed
yuxiangqian opened this issue Apr 10, 2020 · 3 comments
Assignees

Comments

@yuxiangqian
Copy link
Contributor

yuxiangqian commented Apr 10, 2020

Steps to reproduce the issue:

  1. Create a dynamic VolumeSnapshot refer to a VolumeSnapshotClass with DeletionPolicy as Delete, this should trigger a VolumeSnapshotContent creation for the given PVC, and both VolumeSnapshot and VolumeSnapshotContent should have the following finalizer:
    snapshot.storage.kubernetes.io/volumesnapshot-bound-protection
  2. Update VolumeSnapshotContent's DeletionPolicy from Delete to Retain, i.e., kubectl edit and apply.
  3. kubectl delete . This should effectively remove the VolumeSnapshot from API server with VolumeSnapshotContent untouched. However the VolumeSnapshot will not be deleted from API server due to the finalizer.

Root cause is here:
https://github.com/kubernetes-csi/external-snapshotter/blob/master/pkg/common-controller/snapshot_controller.go#L298

The bound finalizer should have been removed from both VolumeSnapshot and VolumeSnapshotContent even if a content exists.

@yuxiangqian
Copy link
Contributor Author

/assign

@yuxiangqian
Copy link
Contributor Author

/cc @xing-yang
When delete a bi-directionally bound VolumeSnapshot and VolumeSnapshotContent with DeletionPolicy set to "Delete" on the content, the original idea is to wait until the VolumeSnapshotContent is removed from API server before removing the bound finalizer on VolumeSnapshot. However that does not apply to the situation when deletion policy is "Retain".

@yuxiangqian yuxiangqian changed the title Not able delete a VolumeSnapshot if it's corresponding VolumeSnapshotContent updates deletion policy from Delete to Retain Not able to delete a VolumeSnapshot if it's corresponding VolumeSnapshotContent updates deletion policy from Delete to Retain Apr 10, 2020
@xing-yang
Copy link
Collaborator

The fix is merged. Closing this.

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

No branches or pull requests

2 participants