This commit does multiple things:
* remove support for AllNodes where we would deploy one rgw per node on
all the nodes.
* a transition path is implemented in the code so that if someone has an
existing deployment, daemonsets will be removed and replaced by an
deployments.
* when using "instances", each rgw deployed has its own key which makes
Ceph reporting the exact number of rgw running, see:
```
[root@rook-ceph-operator-775cf575c5-bh4sr /]# ceph -s
cluster:
id: 611fcf39-0669-4864-9a12-debb35c0397a
health: HEALTH_OK
services:
mon: 3 daemons, quorum a,b,c (age 12h)
mgr: a(active, since 12h)
osd: 3 osds: 3 up (since 12h), 3 in (since 12h)
rgw: 3 daemons active (my.store.a, my.store.b, my.store.c)
data:
pools: 6 pools, 600 pgs
objects: 235 objects, 3.8 KiB
usage: 3.0 GiB used, 84 GiB / 87 GiB avail
pgs: 600 active+clean
```
Closes: https://github.com/rook/rook/issues/2474, https://github.com/rook/rook/issues/2957 and https://github.com/rook/rook/issues/3245
Signed-off-by: Sébastien Han <seb@redhat.com>
8.0 KiB
Rook Object Store
Overview
An object store is a collection of resources and services that work together to serve HTTP requests to PUT and GET objects. Rook will automate the configuration of the Ceph resources and services that are necessary to start and maintain a highly available, durable, and performant object store.
The Ceph object store supports S3 and Swift APIs and a multitude of features such as replication of object stores between different zones. The Rook object store is designed to support all of these features, though will take some time to implement them. We welcome contributions! In the meantime, features that are not yet implemented can be configured by using the Rook toolbox to run the radosgw-admin and other tools for advanced configuration.
Prerequisites
A Rook storage cluster must be configured and running in Kubernetes. In this example, it is assumed the cluster is in the rook namespace.
Object Store Walkthrough
When the storage admin is ready to create an object storage, he will specify his desired configuration settings in a yaml file such as the following object-store.yaml. This example is a simple object store with metadata that is replicated across different hosts, and the data is erasure coded across multiple devices in the cluster.
apiVersion: ceph.rook.io/v1alpha1
kind: ObjectStore
metadata:
name: my-store
namespace: rook-ceph
spec:
metadataPool:
failureDomain: host
replicated:
size: 3
dataPool:
failureDomain: device
erasureCoded:
dataChunks: 6
codingChunks: 2
gateway:
type: s3
port: 80
securePort: 443
instances: 3
Now create the object store.
kubectl create -f object-store.yaml
At this point the Rook operator recognizes that a new object store resource needs to be configured. The operator will create all of the resources to start the object store.
- Metadata pools are created (
.rgw.root,my-store.rgw.control,my-store.rgw.meta,my-store.rgw.log,my-store.rgw.buckets.index) - The data pool is created (
my-store.rgw.buckets.data) - A Ceph realm is created
- A Ceph zone group is created in the new realm
- A Ceph zone is created in the new zone group
- A cephx key is created for the rgw daemon
- A Kubernetes service is created to provide load balancing for the RGW pod(s)
- A Kubernetes deployment is created to start the RGW pod(s) with the settings for the new zone
When the RGW pods start, the object store is ready to receive the http or https requests as configured.
Object Store CRD
The object store settings are exposed to Rook as a Custom Resource Definition (CRD). The CRD is the Kubernetes-native means by which the Rook operator can watch for new resources. The operator stays in a control loop to watch for a new object store, changes to an existing object store, or requests to delete an object store.
Pools
The pools are the backing data store for the object store and are created with specific names to be private to an object store. Pools can be configured with all of the settings that can be specified in the Pool CRD. The underlying schema for pools defined by a pool CRD is the same as the schema under the metadataPool and dataPool elements of the object store CRD. All metadata pools are created with the same settings, while the data pool can be created with independent settings. The metadata pools must use replication, while the data pool can use replication or erasure coding.
metadataPool:
failureDomain: host
replicated:
size: 3
dataPool:
failureDomain: device
erasureCoded:
dataChunks: 6
codingChunks: 2
Gateway
The gateway settings correspond to the RGW service.
type: Can bes3. In the future support forswiftcan be added.sslCertificateRef: If specified, this is the name of the Kubernetes secret that contains the SSL certificate to be used for secure connections to the object store. The secret must be in the same namespace as the Rook cluster. Rook will look in the secret provided at thecertkey name. The value of thecertkey must be in the format expected by the RGW service: "The server key, server certificate, and any other CA or intermediate certificates be supplied in one file. Each of these items must be in pem form." If the certificate is not specified, SSL will not be configured.port: The service port where the RGW service will be listening (http)securePort: The service port where the RGW service will be listening (https)instances: The number of RGW pods that will be started for this object storeplacement: The rgw pods can be given standard Kubernetes placement restrictions withnodeAffinity,tolerations,podAffinity, andpodAntiAffinitysimilar to placement defined for daemons configured by the cluster CRD.
The RGW service can be configured to listen on both http and https by specifying both port and securePort.
gateway:
type: s3
sslCertificateRef: my-ssl-cert-secret
port: 80
securePort: 443
instances: 1
Realms, Zone Groups, and Zones
By default, the object store will be created independently from any other object stores and replication to another object store will not be configured. This done by creating a new realm, zone group, and zone all with the name of the new object store. The zone group and zone are tagged as the master. If this is the first object store in the cluster, the realm, zone group, and zone will also be marked as the default.
By implementing on the independent realms, zone groups, and zones, Rook supports multiple objects stores in a cluster. The set of users with access to the object store, the metadata, and the data are isolated from other object stores.
If desired to configure the object store to replicate from another cluster or zone, the following settings would be specified on a new object store that is not the master. (This feature is not yet implemented.)
realm: If specified, the new zone will be created in the existing realm with that namegroup: If specified, the new zone will be created in the existing zone group with that namemaster: If specified, settings indicate the RGW endpoint where this object store will need to connect to the master zone in order to initialize the replication. The Rook operator will executepullcommands for the realm and zone group as necessary.
zone:
realm: myrealm
group: mygroup
master:
url: https://my-master-zone-gateway:443/
accessKey: my-master-zone-access-key
secret: my-master-zone-secret
Failing over the master could be handled by updating the affected object store CRDs, although more design is needed here.
See the ceph docs here on the concepts around zones and replicating between zones. For reference, a diagram of two zones working across different cluster can be found on page 5 of this doc.
Ceph multi-site object store data model
For reference, here is a description of the underlying Ceph data model.
A cluster has one or more realms
A realm spans one or more clusters
A realm has one or more zone groups
A realm has one master zone group
A realm defined in another cluster is replicated with the pull command
A zone group has one or more zones
A zone group has one master zone
A zone group spans one or more clusters
A zone group defined in another cluster is replicated with the pull command
A zone group defines a namespace for object IDs unique across its zones
Zone group metadata is replicated to other zone groups in the realm
A zone belongs to one cluster
A zone has a set of pools that store the user and object metadata and object data
Zone data and metadata is replicated to other zones in the zone group