Skip to content

Commit d95e851

Browse files
committed
mgr/cephadm: fixing Grafana domain handling
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 <[email protected]>
1 parent 9dc630b commit d95e851

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/pybind/mgr/cephadm/services/monitoring.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def generate_config(self, daemon_spec: CephadmDaemonDeploySpec) -> Tuple[Dict[st
9797
'http_port': grafana_port,
9898
'protocol': spec.protocol,
9999
'http_addr': grafana_ip,
100-
'use_url_prefix': mgmt_gw_enabled
100+
'use_url_prefix': mgmt_gw_enabled,
101+
'domain': daemon_spec.host,
101102
})
102103

103104
if 'dashboard' in self.mgr.get('mgr_map')['modules'] and spec.initial_admin_password:

src/pybind/mgr/cephadm/templates/services/grafana/grafana.ini.j2

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
org_role = 'Viewer'
99
{% endif %}
1010
[server]
11-
domain = 'bootstrap.storage.lab'
11+
domain = '{{ domain }}'
1212
protocol = {{ protocol }}
1313
cert_file = /etc/grafana/certs/cert_file
1414
cert_key = /etc/grafana/certs/cert_key
1515
http_port = {{ http_port }}
1616
http_addr = {{ http_addr }}
1717
{% if use_url_prefix %}
18-
root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/
19-
serve_from_sub_path = true
18+
root_url = %(protocol)s://%(domain)s/grafana/
2019
{% endif %}
2120
[snapshots]
2221
external_enabled = false

src/pybind/mgr/cephadm/tests/test_services.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ def test_grafana_config(self, _run_cephadm, cephadm_module: CephadmOrchestrator)
12241224
org_name = 'Main Org.'
12251225
org_role = 'Viewer'
12261226
[server]
1227-
domain = 'bootstrap.storage.lab'
1227+
domain = 'test'
12281228
protocol = https
12291229
cert_file = /etc/grafana/certs/cert_file
12301230
cert_key = /etc/grafana/certs/cert_key
@@ -1332,7 +1332,7 @@ def test_grafana_initial_admin_pw(self, cephadm_module: CephadmOrchestrator):
13321332
" org_name = 'Main Org.'\n"
13331333
" org_role = 'Viewer'\n"
13341334
'[server]\n'
1335-
" domain = 'bootstrap.storage.lab'\n"
1335+
" domain = 'test'\n"
13361336
' protocol = https\n'
13371337
' cert_file = /etc/grafana/certs/cert_file\n'
13381338
' cert_key = /etc/grafana/certs/cert_key\n'
@@ -1394,7 +1394,7 @@ def test_grafana_no_anon_access(self, cephadm_module: CephadmOrchestrator):
13941394
'[users]\n'
13951395
' default_theme = light\n'
13961396
'[server]\n'
1397-
" domain = 'bootstrap.storage.lab'\n"
1397+
" domain = 'test'\n"
13981398
' protocol = https\n'
13991399
' cert_file = /etc/grafana/certs/cert_file\n'
14001400
' cert_key = /etc/grafana/certs/cert_key\n'

0 commit comments

Comments
 (0)