]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/rook: pass zone attribute to CephObjectStore CR when creating rgw
authorJoseph Sawaya <jsawaya@redhat.com>
Tue, 15 Jun 2021 18:14:40 +0000 (14:14 -0400)
committerSage Weil <sage@newdream.net>
Thu, 17 Jun 2021 13:16:02 +0000 (09:16 -0400)
This commit passes the zone attribute to the CephObjectStore CR when
creating a RGW instance using the Rook Orchestrator backend:
`ceph orch apply rgw <rgw-name> --realm=<realm-name> --zone=<zone-name>`

Signed-off-by: Joseph Sawaya <jsawaya@redhat.com>
src/pybind/mgr/rook/rook_cluster.py

index daf3c8667b71639104a08365d662edd5625dacaf..b78c19b1f146ebd2c466cfa266e56d429fa5278c 100644 (file)
@@ -438,7 +438,6 @@ class RookCluster(object):
             # translate . to - (fingers crossed!) instead.
             name = spec.service_id.replace('.', '-')
 
-        # FIXME: pass realm and/or zone through to the CR
 
         def _create_zone() -> cos.CephObjectStore:
             port = None
@@ -447,21 +446,26 @@ class RookCluster(object):
                 secure_port = spec.get_port()
             else:
                 port = spec.get_port()
-            return cos.CephObjectStore(
-                apiVersion=self.rook_env.api_name,
-                metadata=dict(
-                    name=name,
-                    namespace=self.rook_env.namespace
-                ),
-                spec=cos.Spec(
-                    gateway=cos.Gateway(
-                        type='s3',
-                        port=port,
-                        securePort=secure_port,
-                        instances=spec.placement.count or 1,
+            object_store = cos.CephObjectStore(
+                    apiVersion=self.rook_env.api_name,
+                    metadata=dict(
+                        name=name,
+                        namespace=self.rook_env.namespace
+                    ),
+                    spec=cos.Spec(
+                        gateway=cos.Gateway(
+                            port=port,
+                            securePort=secure_port,
+                            instances=spec.placement.count or 1,
+                        )
                     )
                 )
-            )
+            if spec.rgw_zone:
+                object_store.spec.zone=cos.Zone(
+                            name=spec.rgw_zone
+                        )
+            return object_store
+                
 
         def _update_zone(new: cos.CephObjectStore) -> cos.CephObjectStore:
             new.spec.gateway.instances = spec.placement.count or 1