ceph / ceph/ceph-csi

allow configuring deleted volume retention time

Open
#6,272 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.6k
Forks
617
Avg merge
5d 10h
Merged PRs (30d)
43

Description

ceph supports moving volumes into the trash to be deleted at a configurable time later.
This is very useful to recover from accidentally deleted images

It appears ceph-csi does not allow to configure retention time for deleted volumes, it is hardcoded to 0 seconds
https://github.com/ceph/ceph-csi/blob/devel/internal/rbd/rbd_util.go#L710

tested with v3.14.1
```
rbd ls | grep csi-vol-f3c2954b-1ede-40b4-aada-215719a2fafe
csi-vol-f3c2954b-1ede-40b4-aada-215719a2fafe
kubectl delete pvc name
rbd trash ls
# empty
```

It would be nice if volumes created by ceph-csi could always have a retention time on deleted volumes. Having a single global value for all managed volumes would be sufficient.

# What is the value to the end user? #

It is easy to accidentally delete a persistentvolumeclaim with a volume with reclaimpolicy: delete, directly or indirectly via e.g. namespace deletion.

It would be valuable that this could be recovered by restoring the volume on the ceph store from the trash and restoring the persistentvolume object that that has been backed up via other means.

reclaimpolicy: retain provides this option but in multitenant clusters retaining persistentvolumes introduces additional complexity in handling permissions for reclaiming and cleanup of old volumes.
It also does not protect from accidentally deleting the persistentvolume itself (though that is less likely to happen on accident).

Reopen of https://github.com/ceph/ceph-csi/issues/5830 which got autoclosed as a I wrongly assumed an active mr on the issues makes it not stale ...

There is already tested code implementing this but it needs to be picked up again
https://github.com/ceph/ceph-csi/pull/5871

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in internal/rbd/rbd_util.go around line 710 and review PR #5871, which the issue identifies as an already-tested implementation. Reproduce the reported behavior with rbd ls and rbd trash ls after deleting a PVC, then inspect the existing tests or PR validation. Done means a configurable global retention value is applied to ceph-csi-created volumes and the behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.