Merge "Add support for with_frontend and with_backend"
This commit is contained in:
commit
7c1acb96a0
@ -111,6 +111,10 @@ backend {{ service_name }}_back
|
|||||||
{% set custom_member_list = haproxy_service.custom_member_list|default(none) %}
|
{% set custom_member_list = haproxy_service.custom_member_list|default(none) %}
|
||||||
{# Mode defaults to http #}
|
{# Mode defaults to http #}
|
||||||
{% set mode = haproxy_service.mode|default('http') %}
|
{% set mode = haproxy_service.mode|default('http') %}
|
||||||
|
{# By default each service has its own frontend (hence with_frontend is true by default) #}
|
||||||
|
{% set with_frontend = haproxy_service.with_frontend|default(true)|bool %}
|
||||||
|
{# By default each service has its own backend (hence with_backend is true by default) #}
|
||||||
|
{% set with_backend = haproxy_service.with_backend|default(true)|bool %}
|
||||||
{# Use the parent host group but allow it to be overridden #}
|
{# Use the parent host group but allow it to be overridden #}
|
||||||
{% set host_group = haproxy_service.host_group|default(service.group) %}
|
{% set host_group = haproxy_service.host_group|default(service.group) %}
|
||||||
{# Additional options can be defined in config, and are additive to the global extras #}
|
{# Additional options can be defined in config, and are additive to the global extras #}
|
||||||
@ -125,10 +129,12 @@ backend {{ service_name }}_back
|
|||||||
{% if auth_user and auth_pass %}
|
{% if auth_user and auth_pass %}
|
||||||
{{ userlist_macro(haproxy_name, auth_user, auth_pass) }}
|
{{ userlist_macro(haproxy_name, auth_user, auth_pass) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if with_frontend %}
|
||||||
{{ frontend_macro(haproxy_name, haproxy_service.port, mode, external,
|
{{ frontend_macro(haproxy_name, haproxy_service.port, mode, external,
|
||||||
frontend_http_extra, frontend_tcp_extra) }}
|
frontend_http_extra, frontend_tcp_extra) }}
|
||||||
|
{% endif %}
|
||||||
{# Redirect (to https) is a special case, as it does not include a backend #}
|
{# Redirect (to https) is a special case, as it does not include a backend #}
|
||||||
{% if mode != 'redirect' %}
|
{% if with_backend and mode != 'redirect' %}
|
||||||
{{ backend_macro(haproxy_name, listen_port, mode, host_group,
|
{{ backend_macro(haproxy_name, listen_port, mode, host_group,
|
||||||
custom_member_list, backend_http_extra, backend_tcp_extra,
|
custom_member_list, backend_http_extra, backend_tcp_extra,
|
||||||
auth_user, auth_pass, tls_backend) }}
|
auth_user, auth_pass, tls_backend) }}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
(internal/advanced) Adds support for ``with_frontend`` and ``with_backend``
|
||||||
|
to haproxy service definitions. These new fields preserve the old logic
|
||||||
|
by defaulting to ``true`` but can be set to ``false`` to make the selected
|
||||||
|
service not configure the respective "end".
|
||||||
|
This requires ``haproxy_service_template`` to be set to
|
||||||
|
``haproxy_single_service_split.cfg.j2`` which is the new default.
|
Loading…
x
Reference in New Issue
Block a user