summaryrefslogtreecommitdiff
path: root/src/conf_mode/load-balancing_reverse-proxy.py
diff options
context:
space:
mode:
authorAlex W <embezzle.dev@proton.me>2024-06-03 05:54:07 +0100
committerGitHub <noreply@github.com>2024-06-03 07:54:07 +0300
commit3e5cc0b7fb8ae4a0f8b7c9270d9db0a0f252c448 (patch)
tree96f60d89562759d3ae9c9eeec2e6740c82121b99 /src/conf_mode/load-balancing_reverse-proxy.py
parentd150067ef254a266aef2758e8e92b43c1f22956b (diff)
downloadvyos-1x-3e5cc0b7fb8ae4a0f8b7c9270d9db0a0f252c448.tar.gz
vyos-1x-3e5cc0b7fb8ae4a0f8b7c9270d9db0a0f252c448.zip
reverse-proxy: T6434: Support additional healthcheck options (#3574)
Diffstat (limited to 'src/conf_mode/load-balancing_reverse-proxy.py')
-rwxr-xr-xsrc/conf_mode/load-balancing_reverse-proxy.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/conf_mode/load-balancing_reverse-proxy.py b/src/conf_mode/load-balancing_reverse-proxy.py
index 1c1252df0..09c68dadd 100755
--- a/src/conf_mode/load-balancing_reverse-proxy.py
+++ b/src/conf_mode/load-balancing_reverse-proxy.py
@@ -79,12 +79,21 @@ def verify(lb):
raise ConfigError(f'"TCP" port "{tmp_port}" is used by another service')
for back, back_config in lb['backend'].items():
- if 'http-check' in back_config:
- http_check = back_config['http-check']
+ if 'http_check' in back_config:
+ http_check = back_config['http_check']
if 'expect' in http_check and 'status' in http_check['expect'] and 'string' in http_check['expect']:
raise ConfigError(f'"expect status" and "expect string" can not be configured together!')
+
+ if 'health_check' in back_config:
+ if 'mode' not in back_config or back_config['mode'] != 'tcp':
+ raise ConfigError(f'backend "{back}" can only be configured with {back_config["health_check"]} ' +
+ f'health-check whilst in TCP mode!')
+ if 'http_check' in back_config:
+ raise ConfigError(f'backend "{back}" cannot be configured with both http-check and health-check!')
+
if 'server' not in back_config:
raise ConfigError(f'"{back} server" must be configured!')
+
for bk_server, bk_server_conf in back_config['server'].items():
if 'address' not in bk_server_conf or 'port' not in bk_server_conf:
raise ConfigError(f'"backend {back} server {bk_server} address and port" must be configured!')