]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm/services/ingress Fix HAProxy to listen on IPv4 and IPv6 58515/head
authorBernard Landon <bernard@lndn.ch>
Wed, 26 Jun 2024 22:13:23 +0000 (22:13 +0000)
committerAdam King <adking@redhat.com>
Wed, 10 Jul 2024 14:40:07 +0000 (10:40 -0400)
Commit a9662eee864296da4b9d90b2577ac29db41d0f5c to make HAProxy listen on
both IPv4 and IPv6 was buggy and generated a non-valid HAProxy config file.

Signed-off-by: Bernard Landon <bernard@lndn.ch>
(cherry picked from commit afacfa87260663716f5bdccb659ab7ae93a22072)

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

index e46fab732edb2486f79796c40cbb83364153b850..2488e6012c0aef2fa5f31c72711ffc01bb6a8704 100644 (file)
@@ -169,9 +169,9 @@ class IngressService(CephService):
         if spec.enable_haproxy_protocol:
             server_opts.append("send-proxy-v2")
         logger.debug("enabled default server opts: %r", server_opts)
-        ip = '[..]' if spec.virtual_ips_list else str(spec.virtual_ip).split('/')[0] or daemon_spec.ip or '[..]'
+        ip = '[::]' if spec.virtual_ips_list else str(spec.virtual_ip).split('/')[0] or daemon_spec.ip or '[::]'
         frontend_port = daemon_spec.ports[0] if daemon_spec.ports else spec.frontend_port
-        if ip != '[..]' and frontend_port:
+        if ip != '[::]' and frontend_port:
             daemon_spec.port_ips = {str(frontend_port): ip}
         haproxy_conf = self.mgr.template.render(
             'services/ingress/haproxy.cfg.j2',
index 1c152f31731cec9eefac89297e36774f4ccfe81d..e074be512c28f281b9ab1d81bf17cf55f4bee32d 100644 (file)
@@ -2201,7 +2201,7 @@ class TestIngressService:
                                 'maxconn                 8000\n'
                                 '\nfrontend stats\n    '
                                 'mode http\n    '
-                                'bind [..]:8999\n    '
+                                'bind [::]:8999\n    '
                                 'bind 1.2.3.7:8999\n    '
                                 'stats enable\n    '
                                 'stats uri /stats\n    '
@@ -2210,7 +2210,7 @@ class TestIngressService:
                                 'http-request use-service prometheus-exporter if { path /metrics }\n    '
                                 'monitor-uri /health\n'
                                 '\nfrontend frontend\n    '
-                                'bind [..]:8089\n    '
+                                'bind [::]:8089\n    '
                                 'default_backend backend\n\n'
                                 'backend backend\n    '
                                 'option forwardfor\n    '