]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: populate trusted_ip_list in iscsi-gateway.cfg with mgr ips
authorDaniel Pivonka <dpivonka@redhat.com>
Tue, 21 Sep 2021 20:04:51 +0000 (16:04 -0400)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 2 Nov 2021 09:01:20 +0000 (10:01 +0100)
Iscsi gateways do not show "UP" in dashboard without this

fixes: https://tracker.ceph.com/issues/52692
Signed-off-by: Daniel Pivonka <dpivonka@redhat.com>
(cherry picked from commit cda82c98a32f51cb392fc51ba854bcae409567f8)

Conflicts:
src/pybind/mgr/cephadm/module.py

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/services/iscsi.py
src/pybind/mgr/cephadm/templates/services/iscsi/iscsi-gateway.cfg.j2
src/pybind/mgr/cephadm/tests/test_cephadm.py
src/pybind/mgr/cephadm/tests/test_services.py

index a33e39fa98faf7e154e7bac38c7a786b586971fd..6295c029e2d8dc7e60c389c7e56aa4343c9668eb 100644 (file)
@@ -2263,6 +2263,8 @@ Then run the following:
                 return []
             daemons = self.cache.get_daemons_by_service(spec.service_name())
             deps = [d.name() for d in daemons if d.daemon_type == 'haproxy']
+        elif daemon_type == 'iscsi':
+            deps = [self.get_mgr_ip()]
         else:
             need = {
                 'prometheus': ['mgr', 'alertmanager', 'node-exporter', 'ingress'],
index 750ed956f853272f760a2d5c23553a15837a4588..fa54fa053a4f54b16f28f5cfb8d10731cb2e637a 100644 (file)
@@ -58,17 +58,23 @@ class IscsiService(CephService):
                 'val': key_data,
             })
 
+        # add active mgr ip address to trusted list so dashboard can access
+        trusted_ip_list = spec.trusted_ip_list if spec.trusted_ip_list else ''
+        if trusted_ip_list:
+            trusted_ip_list += ','
+        trusted_ip_list += self.mgr.get_mgr_ip()
+
         context = {
             'client_name': '{}.{}'.format(utils.name_to_config_section('iscsi'), igw_id),
+            'trusted_ip_list': trusted_ip_list,
             'spec': spec
         }
         igw_conf = self.mgr.template.render('services/iscsi/iscsi-gateway.cfg.j2', context)
 
         daemon_spec.keyring = keyring
         daemon_spec.extra_files = {'iscsi-gateway.cfg': igw_conf}
-
         daemon_spec.final_config, daemon_spec.deps = self.generate_config(daemon_spec)
-
+        daemon_spec.deps = [self.mgr.get_mgr_ip()]
         return daemon_spec
 
     def config_dashboard(self, daemon_descrs: List[DaemonDescription]) -> None:
index 2bc13451d65d8a1f6abad4bbdc73de802cd13b3f..c2582ace7af350d8c9bb67e8dd74fa25be45c61d 100644 (file)
@@ -2,7 +2,7 @@
 [config]
 cluster_client_name = {{ client_name }}
 pool = {{ spec.pool }}
-trusted_ip_list = {{ spec.trusted_ip_list|default("''", true) }}
+trusted_ip_list = {{ trusted_ip_list|default("''", true) }}
 minimum_gateways = 1
 api_port = {{ spec.api_port|default("''", true) }}
 api_user = {{ spec.api_user|default("''", true) }}
index fb627f9186575d840107f9bf1c11c6ab88ffcfeb..dfa3cb4b6efad10d7dffade300f4c14c80b66818 100644 (file)
@@ -913,6 +913,7 @@ spec:
     @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}'))
     @mock.patch("subprocess.run", None)
     @mock.patch("cephadm.module.CephadmOrchestrator.rados", mock.MagicMock())
+    @mock.patch("cephadm.module.CephadmOrchestrator.get_mgr_ip", lambda _: '1.2.3.4')
     def test_iscsi(self, cephadm_module):
         with with_host(cephadm_module, 'test'):
             ps = PlacementSpec(hosts=['test'], count=1)
index 2c32dffd9738ab8a4e595c80b4fa7f9f62d32496..4f1bafafd01e20a2100a41ffae50adb97ec591c0 100644 (file)
@@ -42,6 +42,9 @@ class FakeMgr:
     def get_minimal_ceph_conf(self) -> str:
         return ''
 
+    def get_mgr_ip(self) -> str:
+        return '1.2.3.4'
+
 
 class TestCephadmService:
     def test_set_service_url_on_dashboard(self):