Bucket Claim
Rook supports the creation of new buckets and access to existing buckets via two custom resources:
- an
Object Bucket Claim (OBC)
is custom resource which requests a bucket (new or existing) and is described by a Custom Resource Definition (CRD) shown below. - an
Object Bucket (OB)
is a custom resource automatically generated when a bucket is provisioned. It is a global resource, typically not visible to non-admin users, and contains information specific to the bucket. It is described by an OB CRD, also shown below.
An OBC references a storage class which is created by an administrator. The storage class defines whether the bucket requested is a new bucket or an existing bucket. It also defines the bucket retention policy. Users request a new or existing bucket by creating an OBC which is shown below. The ceph provisioner detects the OBC and creates a new bucket or grants access to an existing bucket, depending the storage class referenced in the OBC. It also generates a Secret which provides credentials to access the bucket, and a ConfigMap which contains the bucket's endpoint. Application pods consume the information in the Secret and ConfigMap to access the bucket. Please note that to make provisioner watch the cluster namespace only you need to set ROOK_OBC_WATCH_OPERATOR_NAMESPACE
to true
in the operator manifest, otherwise it watches all namespaces.
The OBC provisioner name found in the storage class by default includes the operator namespace as a prefix. A custom prefix can be applied by the operator setting in the rook-ceph-operator-config
configmap: ROOK_OBC_PROVISIONER_NAME_PREFIX
.
Note
Changing the prefix is not supported on existing clusters. This may impact the function of existing OBCs.
Example¶
OBC Custom Resource¶
name
of theObjectBucketClaim
. This name becomes the name of the Secret and ConfigMap.namespace
(optional) of theObjectBucketClaim
, which is also the namespace of the ConfigMap and Secret.bucketName
name of thebucket
. Not recommended for new buckets since names must be unique within an entire object store.generateBucketName
value becomes the prefix for a randomly generated name, if supplied thenbucketName
must be empty. If bothbucketName
andgenerateBucketName
are supplied thenBucketName
has precedence andGenerateBucketName
is ignored. If bothbucketName
andgenerateBucketName
are blank or omitted then the storage class is expected to contain the name of an existing bucket. It's an error if all three bucket related names are blank or omitted.storageClassName
which defines the StorageClass which contains the names of the bucket provisioner, the object-store and specifies the bucket retention policy.-
additionalConfig
is an optional list of key-value pairs used to define attributes specific to the bucket being provisioned by this OBC. This information is typically tuned to a particular bucket provisioner and may limit application portability. Options supported:maxObjects
: The maximum number of objects in the bucket as a quota on the user account automatically created for the bucket.maxSize
: The maximum size of the bucket as a quota on the user account automatically created for the bucket. Please note minimum recommended value is 4K.bucketMaxObjects
: The maximum number of objects in the bucket as an individual bucket quota. This is useful when the bucket is shared among multiple users.bucketMaxSize
: The maximum size of the bucket as an individual bucket quota.
OBC Custom Resource after Bucket Provisioning¶
namespace
where OBC got created.ObjectBucketName
generated OB name created using name space and OBC name.- the generated (in this case), unique
bucket name
for the new bucket. - name of the storage class from OBC got created.
- phases of bucket creation:
- Pending: the operator is processing the request.
- Bound: the operator finished processing the request and linked the OBC and OB
- Released: the OB has been deleted, leaving the OBC unclaimed but unavailable.
- Failed: not currently set.
App Pod¶
- use
env:
if mapping of the defined key names to the env var names used by the app is needed. - makes available to the pod as env variables:
BUCKET_HOST
,BUCKET_PORT
,BUCKET_NAME
- makes available to the pod as env variables:
AWS_ACCESS_KEY_ID
,AWS_SECRET_ACCESS_KEY
StorageClass¶
label
(optional) here associates thisStorageClass
to a specific provisioner.provisioner
responsible for handlingOBCs
referencing thisStorageClass
.- all
parameter
required. bucketName
is required for access to existing buckets but is omitted when provisioning new buckets. Unlike greenfield provisioning, the brownfield bucket name appears in theStorageClass
, not theOBC
.-
rook-ceph provisioner decides how to treat the
reclaimPolicy
when anOBC
is deleted for the bucket. See explanation as specified in Kubernetes- Delete = physically delete the bucket.
- Retain = do not physically delete the bucket.