diff --git a/doc/source/configure-haproxy.rst b/doc/source/configure-haproxy.rst index dbe514f..7f22bdb 100644 --- a/doc/source/configure-haproxy.rst +++ b/doc/source/configure-haproxy.rst @@ -356,3 +356,16 @@ Here is an example that shows how to achieve the goal This will add two acl rules ``path_sub -i write`` and ``path_sub -i query`` to the front end and use the backend specified in the rule. If no backend is specified it will use a default ``haproxy_service_name`` backend. + +If a frontend service directs to multiple backend services using ACLs, and a +backend service does not require its own corresponding front-end, the +`haproxy_backend_only` option can be specified: + +.. code-block:: yaml + + - service: + haproxy_service_name: influxdb + haproxy_backend_only: true # Directed by the 'influxdb-relay' service above + haproxy_backend_nodes: + - name: influxdb-service + ip_addr: 10.100.10.10 diff --git a/templates/service.j2 b/templates/service.j2 index 100c2b8..597c296 100644 --- a/templates/service.j2 +++ b/templates/service.j2 @@ -29,6 +29,7 @@ {% set vip_binds = item.service.haproxy_bind %} {% endif -%} +{% if not item.service.haproxy_backend_only | default(false) %} {% for vip_bind in vip_binds %} {% if item.service.haproxy_redirect_http_port is defined and item.service.haproxy_ssl %} {% if (loop.index == 1 or item.service.haproxy_ssl_all_vips | default(false) | bool) %} @@ -78,6 +79,7 @@ frontend {{ item.service.haproxy_service_name }}-front-{{ loop.index }} mode {{ item.service.haproxy_balance_type }} default_backend {{ item.service.haproxy_service_name }}-back {% endfor %} +{% endif %} {% set backend_options = item.service.haproxy_backend_options|default([]) %} {% set backend_arguments = item.service.haproxy_backend_arguments|default([]) %}