Delete an Object Storage Bucket

Delete a non protected Object Storage Bucket

If you do not need an Object Storage bucket anymore, you can delete it in the same way as you would with any other object in your cluster:

$ oc delete objectbucket my-bucket

DeletionPolicy

By default, deleting the ObjectBucket will also recursively delete all objects within it and the bucket itself.

To prevent that, there’s a deletionPolicy called DeleteIfEmpty. As the name suggests, it will then only delete the bucket if it’s empty. However, you will still lose access to the data. If you’ve deleted a bucket by mistake and had the DeletIfEmpty policy set, please contact support@vshn.ch and we will help you get your data back.

Example
apiVersion: appcat.vshn.io/v1
kind: ObjectBucket
metadata:
  name: my-cool-bucket
  namespace: my-cool-ns
spec:
  parameters:
    bucketName: my-bucket-change-name
    region: ch-gva-2
    bucketDeletionPolicy: DeleteIfEmpty
Before deleting an ObjectBucket with deletion policy DeleteIfEmpty be sure to remove all data from the bucket itself. Failing to do so may incur additional costs due to bucket not being effectively deleted. Please contact support@vshn.ch for further assistance.

Delete a protected Object Storage Bucket

An Object Storage bucket that is protected from deletion cannot be deleted right away. First disable deletion protection, then delete the instance.

  1. Disable deletion protection:

    $ oc edit objectbucket my-bucket
    apiVersion: appcat.vshn.io/v1
    kind: ObjectBucket
    metadata:
      name: my-cool-bucket
      namespace: my-cool-ns
    spec:
      parameters:
        bucketName: my-bucket-change-name
        region: ch-gva-2
        bucketDeletionPolicy: DeleteIfEmpty
        security:
          deletionProtection: false (1)
    1 Make sure the parameter is set to false
  2. Delete the instance

    $ oc delete objectbucket my-bucket