SynologyOpenSource / synology-csi

Apache License 2.0
466 stars 96 forks source link

The iSCSi remove policy #37

Open 0hlov3 opened 2 years ago

0hlov3 commented 2 years ago

Hi there,

In relation to #5 The iSCSi remove policy.

If I set the Storage class to Retain, then the PVs should be retained, when I delete a PVC. But if I delete them with a kubectl delete pv, they are not removed from the Synology.

Do I have to add any rules to remove the iSCSI-Drives or do I have to remove them manually?

kingdonb commented 2 years ago

if I delete them with a kubectl delete pv, they are not removed from the Synology

As I understand Retain strategy, it means that no garbage collection is done when CSI primitives are deleted from the cluster. The idea being that so long as the underlying storage remains intact, a new cluster with similar storage configuration can attach the same CSI PVs (by volumename or by label?) and regain access to the retained data in that way.

I use this approach for temporary or ephemeral clusters on my network with stateful workloads, to ensure that some stateful backend is persisted from one ephemeral instance into the next (image registry, databases for authentication backends, ...)

When I tested this with volumes that had to be cleaned up after, I went into the SAN Manager app of Synology DiskStation and deleted them manually. If you have a snapshot policy in place, you should be able to restore the LUN from snapshots which are associated with the LUN. But I think the way this is organized, you will need to retain the PV in order to retain any snapshots as they are physically a part of the LUN, and can't be separated from the PV without cloning to a different LUN.

vaskozl commented 9 months ago

I dug into the code, synology-csi gets events directly from the external-provisioner sidecar.

As such, instead of deleting the PV one should just change patch its reclaimPolicy after you are sure you don't need the PV. That way it should be automatically deleted in both the control plane and the actual synology device.