]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: ha-rgw: use correct port
authorSage Weil <sage@newdream.net>
Mon, 22 Mar 2021 19:30:42 +0000 (14:30 -0500)
committerSage Weil <sage@newdream.net>
Mon, 22 Mar 2021 19:31:31 +0000 (14:31 -0500)
The DaemonDescription includes the port that RGW is bound to; use that
in the haproxy configuration.

Signed-off-by: Sage Weil <sage@newdream.net>
src/pybind/mgr/cephadm/services/ha_rgw.py
src/pybind/mgr/cephadm/templates/services/haproxy/haproxy.cfg.j2

index 488088f1d54f971f553ab694bfefcaf712f5744c..6f7abad40c52eb23e1641fe872f36c936143c190 100644 (file)
@@ -13,9 +13,10 @@ class HA_RGWService(CephService):
     TYPE = 'ha-rgw'
 
     class rgw_server():
-        def __init__(self, hostname: str, address: str):
+        def __init__(self, hostname: str, address: str, port: int):
             self.name = hostname
             self.ip = address
+            self.port = port
 
     def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonDeploySpec:
         assert daemon_spec.daemon_type == 'haproxy' or daemon_spec.daemon_type == 'keepalived'
@@ -68,7 +69,10 @@ class HA_RGWService(CephService):
         for daemon in rgw_daemons:
             assert daemon.hostname is not None
             rgw_servers.append(self.rgw_server(
-                daemon.name(), resolve_ip(daemon.hostname)))
+                daemon.name(),
+                resolve_ip(daemon.hostname),
+                daemon.ports[0] if daemon.ports else 80
+            ))
 
         # virtual ip address cannot have netmask attached when passed to haproxy config
         # since the port is added to the end and something like 123.123.123.10/24:8080 is invalid
index 4b3b4cf0782a02c780d8a5382f8034d3f8fe3079..3cc51278f1c90c4ed10cda25fdb6fe8d151586fd 100644 (file)
@@ -62,5 +62,5 @@ backend rgw-backend
     balance static-rr
     option httpchk HEAD / HTTP/1.0
     {% for server in rgw_servers %}
-    server {{ server.name }} {{ server.ip }}:80 check weight 100
+    server {{ server.name }} {{ server.ip }}:{{ server.port }} check weight 100
     {% endfor %}