csi-s3 icon indicating copy to clipboard operation
csi-s3 copied to clipboard

Buckets are not cleaned up unless they are empty

Open mkjpryor-stfc opened this issue 6 years ago • 1 comments

The following behaviour is seen on Google Cloud using the S3 compatibility for Google Cloud Storage.

When a PVC is deleted, the behaviour w.r.t. the underlying PV should be defined entirely by the reclaim policy of the PV. By default, this is Delete - I would expect this to mean that the underlying bucket will be deleted when the PV is deleted. However, this fails with the following message:

controller.go:1138] Deletion of volume "pvc-ebee2c31-b501-11e8-a1ab-42010a9a022c" failed: rpc error: code = Unknown desc = The bucket you tried to delete is not empty.

With a reclaim policy of Delete, I would expect this to succeed, even if the bucket is non-empty. If data-retention is important, the PVs should use a reclaim policy of Retain.

mkjpryor-stfc avatar Sep 10 '18 14:09 mkjpryor-stfc

This should already work, the S3 client empties the bucket first before attempting to delete it.

It looks like this is caused by Google Cloud Storage not supporting S3 multiple object delete: https://cloud.google.com/storage/docs/migrating#methods-comparison

I guess it would be possible to implement a delete on every individual object but this could take a long time if there's a lot of objects to delete.

ctrox avatar Sep 11 '18 19:09 ctrox