]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fixing Grafana domain handling 58402/head
authorRedouane Kachach <rkachach@ibm.com>
Wed, 31 Jul 2024 11:23:13 +0000 (13:23 +0200)
committerRedouane Kachach <rkachach@ibm.com>
Thu, 1 Aug 2024 11:34:29 +0000 (13:34 +0200)
it seems that with Grafana 10.4.0 the domain parameter is taken into
account while building the final url (earlier versions didn't seem to
behave the same way). This change sets the domain to the hostname where
Grafana daemon is running instead of '*.lab'. serve_from_sub_path is
removed as it's no needed and when add it causes some undesirable
redirections that could break monitoring HA.

Signed-off-by: Redouane Kachach <rkachach@ibm.com>
src/pybind/mgr/cephadm/services/monitoring.py
src/pybind/mgr/cephadm/templates/services/grafana/grafana.ini.j2
src/pybind/mgr/cephadm/tests/test_services.py

index 3a20bbfe4853ae07f3ace03fb6bb8ca27c8a3212..33a986fed7a3c5a875ac412bea1cc2ca004fd69f 100644 (file)
@@ -97,7 +97,8 @@ class GrafanaService(CephadmService):
                 'http_port': grafana_port,
                 'protocol': spec.protocol,
                 'http_addr': grafana_ip,
-                'use_url_prefix': mgmt_gw_enabled
+                'use_url_prefix': mgmt_gw_enabled,
+                'domain': daemon_spec.host,
             })
 
         if 'dashboard' in self.mgr.get('mgr_map')['modules'] and spec.initial_admin_password:
index 4d3d11e20831bc80f45d5438131f1f7b245c8a7b..69569ec7b63fd96b956db8eb8ccccda1e253133b 100644 (file)
@@ -8,15 +8,14 @@
   org_role = 'Viewer'
 {% endif %}
 [server]
-  domain = 'bootstrap.storage.lab'
+  domain = '{{ domain }}'
   protocol = {{ protocol }}
   cert_file = /etc/grafana/certs/cert_file
   cert_key = /etc/grafana/certs/cert_key
   http_port = {{ http_port }}
   http_addr = {{ http_addr }}
 {% if use_url_prefix %}
-  root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
-  serve_from_sub_path = true
+  root_url = %(protocol)s://%(domain)s/grafana/
 {% endif %}
 [snapshots]
   external_enabled = false
index 179f11760595824e20c1fc919372b298e4d1b642..816d13cb6fadff673b0c1884d2d06a631250368f 100644 (file)
@@ -1224,7 +1224,7 @@ class TestMonitoring:
                           org_name = 'Main Org.'
                           org_role = 'Viewer'
                         [server]
-                          domain = 'bootstrap.storage.lab'
+                          domain = 'test'
                           protocol = https
                           cert_file = /etc/grafana/certs/cert_file
                           cert_key = /etc/grafana/certs/cert_key
@@ -1332,7 +1332,7 @@ class TestMonitoring:
                                     "  org_name = 'Main Org.'\n"
                                     "  org_role = 'Viewer'\n"
                                     '[server]\n'
-                                    "  domain = 'bootstrap.storage.lab'\n"
+                                    "  domain = 'test'\n"
                                     '  protocol = https\n'
                                     '  cert_file = /etc/grafana/certs/cert_file\n'
                                     '  cert_key = /etc/grafana/certs/cert_key\n'
@@ -1394,7 +1394,7 @@ class TestMonitoring:
                                     '[users]\n'
                                     '  default_theme = light\n'
                                     '[server]\n'
-                                    "  domain = 'bootstrap.storage.lab'\n"
+                                    "  domain = 'test'\n"
                                     '  protocol = https\n'
                                     '  cert_file = /etc/grafana/certs/cert_file\n'
                                     '  cert_key = /etc/grafana/certs/cert_key\n'