net/haproxy: support "monitor-uri" and "monitor fail" in rules, closes #2387

This commit is contained in:
Frank Wall
2021-10-13 23:57:38 +02:00
parent ca805ea20d
commit d483eeba70
4 changed files with 25 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@ Plugin Changelog
Added:
* add support for advanced resolver properties (#2330)
* add graceful stop timeout to service settings
* support "monitor-uri" and "monitor fail" in rules (#2387)
Fixed:
* no haproxy.conf after restoring a config backup (#2474)
@@ -354,6 +354,17 @@
<type>text</type>
<help><![CDATA[A standard HAProxy expression formed by a sample-fetch followed by some converters.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
<style>type_table table_monitor_fail</style>
</field>
<field>
<id>action.monitor_fail_uri</id>
<label>Monitoring URI</label>
<type>text</type>
<help><![CDATA[Specifies a URI which will be intercepted to return HAProxy's health status instead of forwarding the request. When a HTTP request is received, HAProxy will return either "HTTP/1.0 200 OK" or "HTTP/1.0 503 Service unavailable", depending on the fined failure conditions.]]></help>
</field>
<field>
<label>Parameters</label>
<type>header</type>
@@ -2068,6 +2068,7 @@
<http-response_replace-value>http-response header replace value</http-response_replace-value>
<http-response_set-status>http-response set-status</http-response_set-status>
<http-response_set-var>http-response set-var</http-response_set-var>
<monitor_fail>monitor fail: report failure to a monitor request</monitor_fail>
<tcp-request_connection_accept>tcp-request connection accept</tcp-request_connection_accept>
<tcp-request_connection_reject>tcp-request connection reject</tcp-request_connection_reject>
<tcp-request_content_accept>tcp-request content accept</tcp-request_content_accept>
@@ -2252,6 +2253,10 @@
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</http_response_set_var_expr>
<monitor_fail_uri type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
</monitor_fail_uri>
<tcp_request_content_lua type="TextField">
<mask>/^.{1,4096}$/u</mask>
<Required>N</Required>
@@ -522,6 +522,14 @@
{% set action_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif action_data.type == 'monitor_fail' %}
{% if action_data.monitor_fail_uri|default("") != "" %}
{% do action_options.append('monitor-uri ' ~ action_data.monitor_fail_uri ~ '\n ') %}
{% do action_options.append('monitor fail') %}
{% else %}
{% set action_enabled = '0' %}
# ERROR: missing parameters
{% endif %}
{% elif action_data.type == 'tcp-request_connection_accept' %}
{% do action_options.append('tcp-request connection accept') %}
{% elif action_data.type == 'tcp-request_connection_reject' %}