From 6ef8c6378d7f10daa25c90ffe0fb1ffc24e94669 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Wed, 26 Feb 2020 13:09:07 +0100 Subject: [PATCH] mgr/orchestrator: Add alertmanager hooks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristoffer Grönlund --- src/pybind/mgr/orchestrator/_interface.py | 10 ++++++++++ src/pybind/mgr/orchestrator/module.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/src/pybind/mgr/orchestrator/_interface.py b/src/pybind/mgr/orchestrator/_interface.py index 6a521744d8f..f904867fb0f 100644 --- a/src/pybind/mgr/orchestrator/_interface.py +++ b/src/pybind/mgr/orchestrator/_interface.py @@ -1081,6 +1081,16 @@ class Orchestrator(object): """Update existing a Node-Exporter daemon(s)""" raise NotImplementedError() + def add_alertmanager(self, spec): + # type: (ServiceSpec) -> Completion + """Create a new AlertManager service""" + raise NotImplementedError() + + def apply_alertmanager(self, spec): + # type: (ServiceSpec) -> Completion + """Update an existing AlertManager daemon(s)""" + raise NotImplementedError() + def upgrade_check(self, image, version): # type: (Optional[str], Optional[str]) -> Completion raise NotImplementedError() diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index 4aaea608928..a89c69d353e 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -616,6 +616,21 @@ Usage: self._orchestrator_wait([completion]) return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( + 'orch daemon add alertmanager', + 'name=num,type=CephInt,req=false ' + 'name=hosts,type=CephString,n=N,req=false ' + 'name=label,type=CephString,req=false', + 'Add alertmanager daemon(s)') + def _daemon_add_alertmanager(self, num=None, label=None, hosts=[]): + # type: (Optional[int], Optional[str], List[str]) -> HandleCommandResult + spec = ServiceSpec( + placement=PlacementSpec(label=label, hosts=hosts, count=num), + ) + completion = self.add_alertmanager(spec) + self._orchestrator_wait([completion]) + return HandleCommandResult(stdout=completion.result_str()) + @_cli_write_command( 'orch', "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig " -- 2.39.5