Allow default_backend to be specified
Currently default_backend for a service is always set to the haproxy_service_name for a service, but this might not be what is required for some configurations. This patch allows haproxy_default_backend to be configured for a service to customise the default_backend setting. Depends-On: https://review.opendev.org/c/openstack/openstack-ansible-rabbitmq_server/+/876436 Change-Id: I9e2be37cb27a33350577a93f23b69e560493b320
This commit is contained in:
@@ -88,6 +88,7 @@ haproxy_service_configs: []
|
|||||||
# haproxy_frontend_raw:
|
# haproxy_frontend_raw:
|
||||||
# - 'http-request use-service prometheus-exporter if { path /metrics }'
|
# - 'http-request use-service prometheus-exporter if { path /metrics }'
|
||||||
# haproxy_service_enabled: True
|
# haproxy_service_enabled: True
|
||||||
|
# haproxy_default_backend: other_backend
|
||||||
|
|
||||||
galera_monitoring_user: monitoring
|
galera_monitoring_user: monitoring
|
||||||
haproxy_bind_on_non_local: False
|
haproxy_bind_on_non_local: False
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
A new key ``haproxy_default_backend`` can be defined for each service
|
||||||
|
configured in the haproxy loadbalancer. Configuring this variable writes
|
||||||
|
a value for the ``default_backend`` directive into the config for the
|
||||||
|
service frontend. It can be useful to provide a specific default backend
|
||||||
|
as a fall-through option when other backends are selected using ACLs,
|
||||||
|
and to also allow the name of the default backend to be different from
|
||||||
|
``haproxy_service_name``.
|
||||||
@@ -83,8 +83,8 @@ frontend {{ item.service.haproxy_service_name }}-front-{{ loop.index }}
|
|||||||
http-request add-header X-Forwarded-Proto https
|
http-request add-header X-Forwarded-Proto https
|
||||||
{% endif %}
|
{% endif %}
|
||||||
mode {{ item.service.haproxy_balance_type }}
|
mode {{ item.service.haproxy_balance_type }}
|
||||||
{% if not item.service.haproxy_frontend_only | default(false) %}
|
{% if (not item.service.haproxy_frontend_only | default(false)) or ((item.service.haproxy_default_backend is defined) and (item.service.haproxy_default_backend | length > 0)) %}
|
||||||
default_backend {{ item.service.haproxy_service_name }}-back
|
default_backend {{ item.service.haproxy_default_backend | default(item.service.haproxy_service_name) }}-back
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% for entry in (item.service.haproxy_frontend_raw|default([])) + haproxy_frontend_extra_raw %}
|
{% for entry in (item.service.haproxy_frontend_raw|default([])) + haproxy_frontend_extra_raw %}
|
||||||
{{ entry }}
|
{{ entry }}
|
||||||
|
|||||||
Reference in New Issue
Block a user