Add support for HAProxy L7 checks

This change add configuration options from
charm-layer-openstack-api to enable HTTP checks to
the HAProxy configuration, instead of the default TCP
connection checks.

identity_service is created thru Keystone relation and
has the field service_protocol that will say if the
environment is using http or https mode. We disable
certificate verification because we are only interested
in the health of the service.

Closes-Bug: #1880610
Change-Id: Ie091fdfe560b6a060f0c29c6b92a99f5e564eddf
This commit is contained in:
Gabriel Cocenza 2022-10-26 16:39:00 -03:00
parent 8b31ef19e4
commit 4f2f99ffd4
1 changed files with 9 additions and 0 deletions

View File

@ -72,8 +72,17 @@ frontend tcp-in_{{ service }}
{% for frontend in cluster.cluster_hosts -%}
backend {{ service }}_{{ frontend }}
balance leastconn
{% if options.haproxy_check_http -%}
{% for line in options.haproxy_check_http_config.split('\\n') -%}
{{ line }}
{% endfor -%}
{% endif -%}
{% for unit, address in cluster.cluster_hosts[frontend]['backends'].items() -%}
{% if (identity_service is defined) and identity_service.service_protocol == 'https' -%}
server {{ unit }} {{ address }}:{{ ports[1] }} check check-ssl verify none
{% else -%}
server {{ unit }} {{ address }}:{{ ports[1] }} check
{% endif -%}
{% endfor %}
{% endfor -%}
{% endfor -%}