From 4c940577b3f9e9b21964d5f98bfe45b26f991d76 Mon Sep 17 00:00:00 2001 From: Adam King Date: Thu, 13 Apr 2023 13:54:00 -0400 Subject: [PATCH] cephadm: open ports in firewall when adopting monitoring stack daemons Otherwise we risk the prometheus/alertmanager/grafana not functioning properly after adoption due to the necessary port in the firewall not being open. Fixes: https://tracker.ceph.com/issues/59443 Signed-off-by: Adam King (cherry picked from commit 40a98174ccab080fd540e05b6adadcf82e9c2a78) --- src/cephadm/cephadm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 64316ae6085e8..11dd2e11cf3dc 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -7019,6 +7019,9 @@ def command_adopt_prometheus(ctx, daemon_id, fsid): # type: (CephadmContext, str, str) -> None daemon_type = 'prometheus' (uid, gid) = extract_uid_gid_monitoring(ctx, daemon_type) + # should try to set the ports we know cephadm defaults + # to for these services in the firewall. + ports = Monitoring.port_map['prometheus'] _stop_and_disable(ctx, 'prometheus') @@ -7040,7 +7043,7 @@ def command_adopt_prometheus(ctx, daemon_id, fsid): make_var_run(ctx, fsid, uid, gid) c = get_container(ctx, fsid, daemon_type, daemon_id) - deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid) + deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, redeploy=True, ports=ports) update_firewalld(ctx, daemon_type) @@ -7049,6 +7052,9 @@ def command_adopt_grafana(ctx, daemon_id, fsid): daemon_type = 'grafana' (uid, gid) = extract_uid_gid_monitoring(ctx, daemon_type) + # should try to set the ports we know cephadm defaults + # to for these services in the firewall. + ports = Monitoring.port_map['grafana'] _stop_and_disable(ctx, 'grafana-server') @@ -7094,7 +7100,7 @@ def command_adopt_grafana(ctx, daemon_id, fsid): make_var_run(ctx, fsid, uid, gid) c = get_container(ctx, fsid, daemon_type, daemon_id) - deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid) + deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, redeploy=True, ports=ports) update_firewalld(ctx, daemon_type) @@ -7103,6 +7109,9 @@ def command_adopt_alertmanager(ctx, daemon_id, fsid): daemon_type = 'alertmanager' (uid, gid) = extract_uid_gid_monitoring(ctx, daemon_type) + # should try to set the ports we know cephadm defaults + # to for these services in the firewall. + ports = Monitoring.port_map['alertmanager'] _stop_and_disable(ctx, 'prometheus-alertmanager') @@ -7124,7 +7133,7 @@ def command_adopt_alertmanager(ctx, daemon_id, fsid): make_var_run(ctx, fsid, uid, gid) c = get_container(ctx, fsid, daemon_type, daemon_id) - deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid) + deploy_daemon(ctx, fsid, daemon_type, daemon_id, c, uid, gid, redeploy=True, ports=ports) update_firewalld(ctx, daemon_type) -- 2.39.5