provider-gcp
provider-gcp copied to clipboard
Unable to delete bucket if not empty
What problem are you facing?
After deleting a Bucket resource with kubectl, I am getting the following error if bucket is not empty (which is usually the case if you are using that bucket for something real):
- lastTransitionTime: "2021-01-05T10:53:46Z"
message: 'delete failed: cannot delete GCP bucket: googleapi: Error 409: The bucket
you tried to delete was not empty., conflict'
reason: ReconcileError
status: "False"
type: Synced
How could Crossplane help solve your problem?
I understand this is the error that is returned from gcloud API but still wondering whether provider-gcp can add some field in spec, e.g. forceDelete, which could be false by default but can be overridden by user and take case of deletion by deleting content of the bucket first.
I believe this could make sense because, this is also the behaviour of when you delete the bucket from gcloud console, it takes care of whole deletion process with single click, with the following notice: This action will permanently delete the bucket and the objects it contains (including versions) from Google Cloud. Data will not be recoverable.
One could argue that, it is user responsibility to take care of deletion of objects in the bucket, however this introduces pretty much overhead since most people trying to automate workflows with Crossplane (e.g. platform configurations). Imagine an automated process where you create/delete buckets with Crossplane, and just because this functionality missing, users need to automate bucket content deletion which means building yet-another-tool being able to talk gcloud API's and able to authorize with service account keys etc.
Just came across this issue as well. It's not very user-friendly if we cannot delete a non-empty bucket (which is usually the case).
Using crossplane here with kubevela and the inability to remove non empty buckets can end up in a stuck state of the deployed resources. +1 for the forceDelete attribute if this is possible to implement