Setting a bucket class replication policy using a YAML
Provide higher resiliency and better collaboration options by setting a bucket class replication policy using a YAML file.
Before you begin
- Ensure you have a running Fusion Data Foundation Platform.
- 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.
About this task
Applications that require a Multicloud Object Gateway (MCG) bucket class to have a specific replication policy can create a bucket class using the spec.replicationPolicy field.
Procedure
apiVersion: noobaa.io/v1alpha1
kind: BucketClass
metadata:
labels:
app: <desired-app-label>
name: <desired-bucketclass-name>
namespace: <desired-namespace>
spec:
placementPolicy:
tiers:
- backingstores:
- <backingstore>
placement: Spread
replicationPolicy: [{ "rule_id": "<rule id>", "destination_bucket": "first.bucket", "filter": {"prefix": "<object name prefix>"}}]
This YAML is an example that creates a placement bucket class. Each Object bucket claim (OBC)
object that is uploaded to the bucket is filtered based on the prefix and is replicated to
first.bucket
.
- desired-app-label
-
Specify a label for the app.
- desired-bucketclass-name
-
Specify the bucket class name.
- desired-namespace
-
Specify the namespace in which the bucket class gets created.
- backingstore
-
Specify the name of a backingstore. It is possible to pass several backingstores.
- rule_id
-
Specify the ID number of the rule, for example,
`{"rule_id": "rule-1"}
. - destination_bucket
-
Specify the name of the destination bucket, for example,
{"destination_bucket": "first.bucket"}
. - object name prefix
- (Optional:) It is the prefix of the object keys that should be replicated, and you can even
leave it empty, for example,
{"prefix": ""}
.