From: Bernard Landon Date: Fri, 1 Mar 2024 21:18:32 +0000 (+0100) Subject: mgr/cephadm/services/ingress make HAProxy to listen on IPv4 and IPv6 by default X-Git-Tag: v19.1.0~166^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=16de9ecef517789185f0dd9ae605309774bdd23a;p=ceph.git mgr/cephadm/services/ingress make HAProxy to listen on IPv4 and IPv6 by default By default, HAProxy will only bind to IPv4 addresses preventing the ingress service to be used in dual stack or mixed IPv4/IPv6 environments. This patch changes the default so HAProxy would bind both on IPv4 and IPv6 addresses. Signed-off-by: Bernard Landon (cherry picked from commit a9662eee864296da4b9d90b2577ac29db41d0f5c) --- diff --git a/src/pybind/mgr/cephadm/services/ingress.py b/src/pybind/mgr/cephadm/services/ingress.py index 55be3045466..ad672904912 100644 --- a/src/pybind/mgr/cephadm/services/ingress.py +++ b/src/pybind/mgr/cephadm/services/ingress.py @@ -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', diff --git a/src/pybind/mgr/cephadm/tests/test_services.py b/src/pybind/mgr/cephadm/tests/test_services.py index dbab022058d..dad123b09f2 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -2033,7 +2033,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 ' @@ -2042,7 +2042,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 '