Create an Object Storage Bucket

AppCat allows DevOps engineers to quickly provision S3-compatible Object Storage Buckets in various environments.

Create a Bucket

Follow these steps to login to APPUiO Cloud on your terminal:

  1. Login to the APPUiO Cloud console:

    oc login --server=https://api.${zone}.appuio.cloud:6443

    You can find the exact URL of your chosen zone in the APPUiO Cloud Portal.

    This command displays a URL on your terminal:

    You must obtain an API token by visiting
    https://oauth-openshift.apps.${zone}.appuio.cloud/oauth/token/request
  2. Click on the link above and open it in your browser.

  3. Click "Display token" and copy the login command shown as "Log in with this token"

  4. Paste the oc login command on the terminal:

    oc login --token=sha256~_xxxxxx_xxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxx-X \
        --server=https://api.${zone}.appuio.cloud:6443
  5. Apply the following object on your namespace, as specified by its YAML description.

    Example to create an Object Storage bucket
    apiVersion: appcat.vshn.io/v1
    kind: ObjectBucket
    metadata:
      name: my-cool-bucket
      namespace: my-namespace (1)
    spec:
      parameters:
        bucketName: my-bucket-change-name (2)
        region: rma (3)
      writeConnectionSecretToRef:
        name: objectbucket-creds (4)
    1 The namespace where the object will be created.
    2 Bucket name: don’t just copy/paste this code, remember to choose your own name here!
    3 The bucket’s region depends on the selected Provider, see here for more details
    4 Secret where the connection details are provisioned. This secret shouldn’t exist at this time.
    Object Storage Bucket names must be unique across providers. Make sure to choose a name with prefixes and other guards, to prevent any issue during the creation of the bucket. No error message is returned if the bucket cannot be created.

Create a Bucket in another cloud provider

By default the bucket is created on the same cloud provider where the cluster is running on. For instance, if you are on an Exoscale cluster, to create an ObjectBucket on cloudscale.ch add the following YAML snippet to the spec of an ObjectBucket:

spec:
  compositionRef:
    name: cloudscale.objectbuckets.appcat.vshn.io (1)
  parameters:
    region: rma (2)
1 The reference name of the backing cloud provider, see here for available references.
2 Change the region identifier in accordance for the resp. cloud provider, see here for more details.

This mechanism allows advanced deployment or failover scenarios. For example, if your application is running on Exoscale, you can create a primary bucket on Exoscale and a secondary bucket on cloudscale.ch or vice versa. Using a mirroring tool like rclone you can achieve bucket replication between different cloud providers.

  1. Get information about your new bucket object.

    $ oc get objectbucket
    NAME               READY   CONNECTION-SECRET    AGE
    my-cool-bucket     True    objectbucket-creds   5s

    If you see the "True" value in the READY column, it means that your bucket is provisioned and ready to use.

    If your object bucket doesn’t get the state ready after a while, try to delete the bucket and re-create it with a different name.
  2. Get the required secrets to use your bucket from other applications.

    $ oc get secrets objectbucket-creds -oyaml

    The complete specification of the generated secret object can be found in the secrets page.

  3. Check the bucket status

    $ oc describe objectbucket my-cool-bucket
    Name:         my-cool-bucket
    Namespace:    a-demo-project
    # …
    Status:
      Conditions:
        Last Transition Time:  2022-09-02T07:38:40Z
        Reason:                Available
        Status:                True
        Type:                  Ready
      Connection Details:
        Last Published Time:  2022-09-02T07:38:40Z
    Events:
      Type     Reason                      Age                From                                                             Message
      ----     ------                      ----               ----                                                             -------
      Warning  ConfigureCompositeResource  12m (x2 over 12m)  offered/compositeresourcedefinition.apiextensions.crossplane.io  cannot apply composite resource: cannot patch object: Operation cannot be fulfilled on xobjectbuckets.appcat.vshn.io "my-cool-bucket-2ds78": the object has been modified; please apply your changes to the latest version and try again
      Normal   ConfigureCompositeResource  12m (x8 over 12m)  offered/compositeresourcedefinition.apiextensions.crossplane.io  Successfully applied composite resource
      Normal   BindCompositeResource       12m (x6 over 12m)  offered/compositeresourcedefinition.apiextensions.crossplane.io  Composite resource is not yet ready
      Normal   BindCompositeResource       12m (x2 over 12m)  offered/compositeresourcedefinition.apiextensions.crossplane.io  Successfully bound composite resource
      Normal   PropagateConnectionSecret   12m                offered/compositeresourcedefinition.apiextensions.crossplane.io  Successfully propagated connection details from composite resource