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: v20.0.0~2367^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a9662eee864296da4b9d90b2577ac29db41d0f5c;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 --- 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 f0b5360e6e3..c716d7d182f 100644 --- a/src/pybind/mgr/cephadm/tests/test_services.py +++ b/src/pybind/mgr/cephadm/tests/test_services.py @@ -2053,7 +2053,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 ' @@ -2062,7 +2062,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 '