]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: set haxproxy protocol in config when enabled
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:36:15 +0000 (13:36 -0400)
When the haproxy protocol is enabled at the service level, add the
'send-proxy-v2' option to the haproxy configuration file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit c56953f2570337e48c812a137338a96f989b6cfb)

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

index 7523bc086cee667a64f0c1e1ba6d1e4c4187f2ed..95cff4bad194460c234f9a0be18f73982c133921 100644 (file)
@@ -165,6 +165,10 @@ class IngressService(CephService):
             ]
 
         host_ip = daemon_spec.ip or self.mgr.inventory.get_addr(daemon_spec.host)
+        server_opts = []
+        if spec.enable_haproxy_protocol:
+            server_opts.append("send-proxy-v2")
+        logger.debug("enabled default server opts: %r", server_opts)
         haproxy_conf = self.mgr.template.render(
             'services/ingress/haproxy.cfg.j2',
             {
@@ -177,7 +181,8 @@ class IngressService(CephService):
                 '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,
                 'monitor_port': daemon_spec.ports[1] if daemon_spec.ports else spec.monitor_port,
-                'local_host_ip': host_ip
+                'local_host_ip': host_ip,
+                'default_server_opts': server_opts,
             }
         )
         config_files = {