]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: allow init-state for dynamic servers
authorDamien Claisse <d.claisse@criteo.com>
Tue, 10 Sep 2024 14:52:42 +0000 (14:52 +0000)
committerWilly Tarreau <w@1wt.eu>
Tue, 10 Sep 2024 16:18:38 +0000 (18:18 +0200)
Commit 50322df introduced the init-state keyword, but it didn't enable
it for dynamic servers. However, this feature is perfectly desirable
for virtual servers too, where someone would like a server inlived
through "set server be1/srv1 state ready" to be put out of maintenance
in down state until the next health check succeeds.
At reading the code, it seems that it's only a matter of allowing this
keyword for dynamic servers, as current code path calls
srv_adm_set_ready() which incidentally triggers a call to
_srv_update_status_adm().

doc/configuration.txt
src/server.c

index fd7ea4329aad8ab3668d5f7c485b30b985f977b1..4a5a5fffc510d5c0c4b8d51d49d243d46c3b6c48 100644 (file)
@@ -17571,7 +17571,8 @@ init-state { fully-up | up | down | fully-down }
 
   The server's init-state is considered when the HAProxy instance is
   (re)started, a new server is detected (for example via service discovery /
-  DNS resolution), a server exits maintenance, etc.
+  DNS resolution), a dynamic server is inlived, a server exits maintenance,
+  etc.
 
   Examples:
       # pass client traffic ONLY to Redis "master" node
index 29beffe8234602a314b7115dd2df97295eb27d39..b8d4d2d2a633417ffaac5288d4841d5b85ed7034 100644 (file)
@@ -2323,7 +2323,7 @@ static struct srv_kw_list srv_kws = { "ALL", { }, {
        { "hash-key",             srv_parse_hash_key,             1,  1,  1 }, /* Configure how chash keys are computed */
        { "id",                   srv_parse_id,                   1,  0,  1 }, /* set id# of server */
        { "init-addr",            srv_parse_init_addr,            1,  1,  0 }, /* */
-       { "init-state",           srv_parse_init_state,           1,  1,  0 }, /* Set the initial state of the server */
+       { "init-state",           srv_parse_init_state,           1,  1,  1 }, /* Set the initial state of the server */
        { "log-bufsize",          srv_parse_log_bufsize,          1,  1,  0 }, /* Set the ring bufsize for log server (only for log backends) */
        { "log-proto",            srv_parse_log_proto,            1,  1,  0 }, /* Set the protocol for event messages, only relevant in a log or ring section */
        { "maxconn",              srv_parse_maxconn,              1,  1,  1 }, /* Set the max number of concurrent connection */