diff options
author | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-06-03 13:57:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-03 13:57:58 +0300 |
commit | d2d8dd1de6e52b7835a0030f42f808433282eea8 (patch) | |
tree | 806d23fbe0a233be8b74811b04386fbf09811198 /src | |
parent | c6a8522c4c20078bb33157fc803373bf3532a02b (diff) | |
download | vyos-1x-d2d8dd1de6e52b7835a0030f42f808433282eea8.tar.gz vyos-1x-d2d8dd1de6e52b7835a0030f42f808433282eea8.zip |
reverse-proxy: T6434: Support additional healthcheck options (#3574) (#3577)
(cherry picked from commit 3e5cc0b7fb8ae4a0f8b7c9270d9db0a0f252c448)
Co-authored-by: Alex W <embezzle.dev@proton.me>
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/load-balancing_reverse-proxy.py | 13 |
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!') |