Skip to content

Commit 9f554ee

Browse files
committed
mgr/prometheus: improve how we check security configuration status
So far we have been using some indirect methods for that. Let's be more explicit about the check and use the new API offered by the cephadm for that. Fixes: https://tracker.ceph.com/issues/71599 Signed-off-by: Redouane Kachach <[email protected]>
1 parent e7f2896 commit 9f554ee

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/pybind/mgr/prometheus/module.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1761,21 +1761,17 @@ def self_test(self) -> None:
17611761
self.get_file_sd_config()
17621762

17631763
def configure(self, server_addr: str, server_port: int) -> None:
1764-
# TODO(redo): this new check is hacky, we should provide an explit cmd
1765-
# from cephadm to get/check the security status
1766-
1767-
# if cephadm is configured with security then TLS must be used
1768-
cmd = {'prefix': 'orch prometheus get-credentials'}
1764+
cmd = {'prefix': 'orch get-security-config'}
17691765
ret, out, _ = self.mon_command(cmd)
17701766
if ret == 0 and out is not None:
1771-
access_info = json.loads(out)
1772-
if access_info:
1773-
try:
1767+
try:
1768+
security_config = json.loads(out)
1769+
if security_config.get('security_enabled', False):
17741770
self.setup_tls_using_cephadm(server_addr, server_port)
17751771
return
1776-
except Exception as e:
1777-
self.log.exception(f'Failed to setup cephadm based secure monitoring stack: {e}\n',
1778-
'Falling back to default configuration')
1772+
except Exception as e:
1773+
self.log.exception(f'Failed to setup cephadm based secure monitoring stack: {e}\n',
1774+
'Falling back to default configuration')
17791775

17801776
# In any error fallback to plain http mode
17811777
self.setup_default_config(server_addr, server_port)

src/pybind/mgr/rook/module.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,10 @@ def _get_pool_params(self) -> Tuple[int, str]:
531531
break
532532
return num_replicas, leaf_type
533533

534+
@handle_orch_error
535+
def get_security_config(self) -> Dict[str, bool]:
536+
return {}
537+
534538
@handle_orch_error
535539
def remove_service(self, service_name: str, force: bool = False) -> str:
536540
if service_name == 'rbd-mirror':

0 commit comments

Comments
 (0)