sig-storage-local-static-provisioner icon indicating copy to clipboard operation
sig-storage-local-static-provisioner copied to clipboard

Delete local PV If directory not found

Open msau42 opened this issue 6 years ago • 7 comments

Migrating issue from: https://github.com/kubernetes-incubator/external-storage/issues/1052

/help

msau42 avatar Dec 19 '18 00:12 msau42

@msau42: This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to this:

Migrating issue from: https://github.com/kubernetes-incubator/external-storage/issues/1052

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Dec 19 '18 00:12 k8s-ci-robot

/kind bug

msau42 avatar Dec 19 '18 00:12 msau42

Thinking more about this (previous thoughts). It's hard to see delete local PV if directory not found is a good idea.

Possible scenarios when the volume is not found on deletion:

  • node gets recreated with the same name: https://github.com/kubernetes-incubator/external-storage/issues/1052#issue-378532378
  • node gets deleted
  • node reboots but didn't mount volumes (because of invalid /etc/fstab file or something)

If we deleted PVs in these cases in provisioner, users are in charge of cleaning up volumes themselves which is a burden, and if users forgot to clean, data in volumes may be leaked to other programs in the future.

Instead of letting users clean up volumes, I think the best practice is to delete PV objects if users know volumes of these PVs are already cleaned or deleted and they want to clean these stale PV objects. And it's totally ok to not delete them if they are not sure. When a node gets recreated, users can delete all local PVs on it which is required too when a node is deleted.

(Updated: You can set owner references on PV objects, then they can be deleted when node objects are deleted)

Conversely, I think we should check mount point existence on deletion because if no mount point exists on the directory, we actually didn't clean local volume and should not delete PV objects. With this change, volumes are not able to be deleted if they are not mounted on reboot. When disks are mounted again, data can be cleaned and PV objects will be recycled by provisioner.

cofyc avatar Apr 17 '19 12:04 cofyc

/assign

cofyc avatar Apr 17 '19 12:04 cofyc

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Jul 16 '19 16:07 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar Aug 15 '19 17:08 fejta-bot

/lifecycle frozen

cofyc avatar Sep 01 '19 05:09 cofyc