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 '[::]'
+ v4v6_flag = "v4v6" if ip == "[::]" else ""
+
frontend_port = daemon_spec.ports[0] if daemon_spec.ports else spec.frontend_port
if ip != '[::]' and frontend_port:
daemon_spec.port_ips = {str(frontend_port): ip}
'local_host_ip': host_ip,
'default_server_opts': server_opts,
'health_check_interval': spec.health_check_interval or '2s',
+ 'v4v6_flag': v4v6_flag,
}
)
config_files = {
haproxy_generated_conf = service_registry.get_service('ingress').haproxy_generate_config(
CephadmDaemonDeploySpec(host='host1', daemon_id='ingress', service_name=ispec.service_name()))
- assert haproxy_generated_conf[0] == haproxy_expected_conf
+ haproxy_generated_conf = haproxy_generated_conf[0]
+ gen_config_lines = [line.rstrip() for line in haproxy_generated_conf['files']['haproxy.cfg'].splitlines()]
+ exp_config_line = [line.rstrip() for line in haproxy_expected_conf['files']['haproxy.cfg'].splitlines()]
+
+ assert gen_config_lines == exp_config_line
# swapping order now, should still pick out the one with the higher rank_generation
# in this case both nfs are rank 0, so it should only take the one with rank_generation 1 a.k.a
]
_get_daemons_by_service.return_value = nfs_daemons
- haproxy_generated_conf = service_registry.get_service('ingress').haproxy_generate_config(
+ haproxy_generated_conf, _ = service_registry.get_service('ingress').haproxy_generate_config(
CephadmDaemonDeploySpec(host='host1', daemon_id='ingress', service_name=ispec.service_name()))
- assert haproxy_generated_conf[0] == haproxy_expected_conf
+ gen_config_lines = [line.rstrip() for line in haproxy_generated_conf['files']['haproxy.cfg'].splitlines()]
+ exp_config_lines = [line.rstrip() for line in haproxy_expected_conf['files']['haproxy.cfg'].splitlines()]
+
+ assert gen_config_lines == exp_config_lines
@patch("cephadm.serve.CephadmServe._run_cephadm")
def test_ingress_config(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
}
}
- assert haproxy_generated_conf[0] == haproxy_expected_conf
+ gen_config_lines = [line.rstrip() for line in haproxy_generated_conf[0]['files']['haproxy.cfg'].splitlines()]
+ exp_config_lines = [line.rstrip() for line in haproxy_expected_conf['files']['haproxy.cfg'].splitlines()]
+
+ assert gen_config_lines == exp_config_lines
@patch("cephadm.serve.CephadmServe._run_cephadm")
def test_ingress_config_ssl_rgw(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
}
}
- assert haproxy_generated_conf[0] == haproxy_expected_conf
+ gen_config_lines = [line.rstrip() for line in haproxy_generated_conf[0]['files']['haproxy.cfg'].splitlines()]
+ exp_config_lines = [line.rstrip() for line in haproxy_expected_conf['files']['haproxy.cfg'].splitlines()]
+ assert gen_config_lines == exp_config_lines
@patch("cephadm.serve.CephadmServe._run_cephadm")
def test_ingress_config_multi_vips(self, _run_cephadm, cephadm_module: CephadmOrchestrator):
'http-request use-service prometheus-exporter if { path /metrics }\n '
'monitor-uri /health\n'
'\nfrontend frontend\n '
- 'bind [::]:8089\n '
+ 'bind [::]:8089 v4v6\n '
'default_backend backend\n\n'
'backend backend\n '
'option forwardfor\n '
service_name=ispec.service_name(),
),
)
- assert haproxy_generated_conf == haproxy_expected_conf
+ gen_config_lines = [line.rstrip() for line in haproxy_generated_conf['files']['haproxy.cfg'].splitlines()]
+ exp_config_lines = [line.rstrip() for line in haproxy_expected_conf['files']['haproxy.cfg'].splitlines()]
+ assert gen_config_lines == exp_config_lines
nfs_generated_conf, _ = nfs_svc.generate_config(
CephadmDaemonDeploySpec(