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 <rgw-name> --realm=<realm-name> --zone=<zone-name>`

Signed-off-by: Joseph Sawaya <jsawaya@redhat.com>
This commit is contained in:
Joseph Sawaya 2021-06-15 14:14:40 -04:00 committed by Sage Weil
parent af622e8cd7
commit 68b13c262c

View 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