From 818b8583c84b9aabdd8a9b5d661608904c60ae67 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 20 Mar 2020 17:11:24 -0400 Subject: [PATCH] mgr/rook: list rgw services Signed-off-by: Sage Weil --- src/pybind/mgr/rook/module.py | 31 ++++++++++++++++++++++++++++- src/pybind/mgr/rook/rook_cluster.py | 3 +++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index d1fad01e02b34..cabc5080a790a 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -320,7 +320,36 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator): last_refresh=now, ) - # FIXME: CephObjectstores + # CephObjectstores + all_zones = self.rook_cluster.rook_api_get( + "cephobjectstores/") + self.log.debug('CephObjectstores %s' % all_zones) + for zone in all_zones.get('items', []): + rgw_realm = zone['metadata']['name'] + rgw_zone = rgw_realm + svc = 'rgw.' + rgw_realm + '.' + rgw_zone + if svc in spec: + continue + active = zone['spec']['gateway']['instances']; + if 'securePort' in zone['spec']['gateway']: + ssl = True + port = zone['spec']['gateway']['securePort'] + else: + ssl = False + port = zone['spec']['gateway']['port'] or 80 + spec[svc] = orchestrator.ServiceDescription( + service_name=svc, + spec=RGWSpec( + rgw_realm=rgw_realm, + rgw_zone=rgw_zone, + ssl=ssl, + rgw_frontend_port=port, + placement=PlacementSpec(count=active), + ), + size=active, + container_image_name=image_name, + last_refresh=now, + ) for dd in self._list_daemons(): if dd.service_name() not in spec: diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index 2686c61e9df68..f177c1668e804 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -335,6 +335,9 @@ class RookCluster(object): 'phase': d['status']['phase'], 'container_image_name': image_name, 'refreshed': refreshed, + # these may get set below... + 'started': None, + 'created': None, } # note: we want UTC but no tzinfo -- 2.39.5