From 68b13c262c73480803c85a0bdc452e8d8010ba72 Mon Sep 17 00:00:00 2001 From: Joseph Sawaya Date: Tue, 15 Jun 2021 14:14:40 -0400 Subject: [PATCH] mgr/rook: pass zone attribute to CephObjectStore CR when creating rgw This commit passes the zone attribute to the CephObjectStore CR when creating a RGW instance using the Rook Orchestrator backend: `ceph orch apply rgw --realm= --zone=` Signed-off-by: Joseph Sawaya --- src/pybind/mgr/rook/rook_cluster.py | 32 ++++++++++++++++------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index daf3c8667b7..b78c19b1f14 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -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 -- 2.39.5