Adding an AWS S3 namespace bucket using the Multicloud Object Gateway CLI

Add an AWS S3 namespace bucket using the Multicloud Object Gateway CLI.

Before you begin

  • Install OpenShift Container Platform with Fusion Data Foundation operator.
  • Ensure you have access to the Multicloud Object Gateway (MCG), see Accessing the Multicloud Object Gateway with your applications.
  • Download the MCG command-line interface for easier management.
    subscription-manager repos --enable=rh-odf-4-for-rhel-8-x86_64-rpms
    yum install mcg
    Note: Specify the appropriate architecture for enabling the repositories using the subscription manager. In case of IBM Z infrastructure, use the following command:
    subscription-manager repos --enable=rh-odf-4-for-rhel-8-s390x-rpms
  • Alternatively, you can install the MCG package from the RPMs found at Download Red Hat OpenShift Data Foundation page.

    Note: Choose the correct Product Variant according to your architecture.

Procedure

  1. In the MCG command-line interface, create a NamespaceStore resource.
    A NamespaceStore represents an underlying storage to be used as a read or write target for the data in MCG namespace buckets.
    noobaa namespacestore create aws-s3 <namespacestore> --access-key <AWS ACCESS KEY> --secret-key <AWS SECRET ACCESS KEY> --target-bucket <bucket-name> -n openshift-storage
    namespacestore

    The name of the NamespaceStore.

    AWS ACCESS KEY and AWS SECRET ACCESS KEY

    The AWS access key ID and secret access key you created for this purpose.

    bucket-name

    The existing AWS bucket name. This argument tells the MCG which bucket to use as a target bucket for its backing store, and subsequently, data storage and administration.

  2. Create a namespace bucket class that defines a namespace policy for the namespace buckets. The namespace policy can be either single or multi.
    • To create a namespace bucket class with a namespace policy of type single:

      noobaa bucketclass create namespace-bucketclass single <my-bucket-class> --resource <resource> -n openshift-storage
      resource-name
      The name you want to give the resource.
      my-bucket-class
      A unique bucket class name.
      resource
      A single namespace-store that defines the read and write target of the namespace bucket.
    • To create a namespace bucket class with a namespace policy of type multi:

      noobaa bucketclass create namespace-bucketclass multi <my-bucket-class> --write-resource <write-resource> --read-resources <read-resources> -n openshift-storage
      resource-name

      The name you want to give the resource.

      my-bucket-class

      A unique bucket class name.

      write-resource

      A single namespace-store that defines the write target of the namespace bucket.

      read-resources

      A list of namespace-stores separated by commas that defines the read targets of the namespace bucket.

  3. Create a bucket using an Object Bucket Class (OBC) resource that uses the bucket class defined in the previous step.
    noobaa obc create my-bucket-claim -n openshift-storage --app-namespace my-app --bucketclass <custom-bucket-class>
    bucket-name

    A bucket name of your choice.

    custom-bucket-class

    The name of the bucket class created in the previous step.

    After the OBC is provisioned by the operator, a bucket is created in the MCG, and the operator creates a Secret and a ConfigMap with the same name and in the same namespace as that of the OBC.