Skip to content

Commit afacfa8

Browse files
committed
mgr/cephadm/services/ingress Fix HAProxy to listen on IPv4 and IPv6
Commit a9662ee to make HAProxy listen on both IPv4 and IPv6 was buggy and generated a non-valid HAProxy config file. Signed-off-by: Bernard Landon <[email protected]>
1 parent 4d5b2cd commit afacfa8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,9 +169,9 @@ def haproxy_generate_config(
169169
if spec.enable_haproxy_protocol:
170170
server_opts.append("send-proxy-v2")
171171
logger.debug("enabled default server opts: %r", server_opts)
172-
ip = '[..]' if spec.virtual_ips_list else str(spec.virtual_ip).split('/')[0] or daemon_spec.ip or '[..]'
172+
ip = '[::]' if spec.virtual_ips_list else str(spec.virtual_ip).split('/')[0] or daemon_spec.ip or '[::]'
173173
frontend_port = daemon_spec.ports[0] if daemon_spec.ports else spec.frontend_port
174-
if ip != '[..]' and frontend_port:
174+
if ip != '[::]' and frontend_port:
175175
daemon_spec.port_ips = {str(frontend_port): ip}
176176
haproxy_conf = self.mgr.template.render(
177177
'services/ingress/haproxy.cfg.j2',

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2201,7 +2201,7 @@ def test_ingress_config_multi_vips(self, _run_cephadm, cephadm_module: CephadmOr
22012201
'maxconn 8000\n'
22022202
'\nfrontend stats\n '
22032203
'mode http\n '
2204-
'bind [..]:8999\n '
2204+
'bind [::]:8999\n '
22052205
'bind 1.2.3.7:8999\n '
22062206
'stats enable\n '
22072207
'stats uri /stats\n '
@@ -2210,7 +2210,7 @@ def test_ingress_config_multi_vips(self, _run_cephadm, cephadm_module: CephadmOr
22102210
'http-request use-service prometheus-exporter if { path /metrics }\n '
22112211
'monitor-uri /health\n'
22122212
'\nfrontend frontend\n '
2213-
'bind [..]:8089\n '
2213+
'bind [::]:8089\n '
22142214
'default_backend backend\n\n'
22152215
'backend backend\n '
22162216
'option forwardfor\n '

0 commit comments

Comments
 (0)