From: Redouane Kachach Date: Fri, 7 Mar 2025 05:54:24 +0000 (+0100) Subject: mgr/cephadm: use ip_hash to enforce the same prometheues upstream X-Git-Tag: v20.3.0~305^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bfcb5334c2f50fa32d8054d8800c6cede488f9d9;p=ceph.git mgr/cephadm: use ip_hash to enforce the same prometheues upstream Implemented ip_hash in Nginx to ensure consistent upstream selection for Prometheus in HA scenarios. This helps maintain query consistency in Grafana and reduces gaps caused by Prometheus instance failovers. Fixes: https://tracker.ceph.com/issues/70352? Signed-off-by: Redouane Kachach --- diff --git a/src/pybind/mgr/cephadm/templates/services/mgmt-gateway/nginx.conf.j2 b/src/pybind/mgr/cephadm/templates/services/mgmt-gateway/nginx.conf.j2 index 14af0fd48ca..035e6f9e68c 100644 --- a/src/pybind/mgr/cephadm/templates/services/mgmt-gateway/nginx.conf.j2 +++ b/src/pybind/mgr/cephadm/templates/services/mgmt-gateway/nginx.conf.j2 @@ -52,6 +52,7 @@ http { {% if prometheus_endpoints %} upstream prometheus_servers { + ip_hash; {% for ep in prometheus_endpoints %} server {{ ep }}; {% endfor %} diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index ecadc7a0049..08e861652a2 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -4004,6 +4004,7 @@ class TestMgmtGateway: } upstream prometheus_servers { + ip_hash; server 192.168.100.100:9095; server 192.168.100.101:9095; } @@ -4256,6 +4257,7 @@ class TestMgmtGateway: } upstream prometheus_servers { + ip_hash; server 192.168.100.100:9095; server 192.168.100.101:9095; }