mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Management framework: trigger deployment upon when instances are ready
More resilience: when an agent restarts, it checks in with the controller. If the controller has deployed a config, this check-in may lead to an internal notify_agents_ready event. At that point, we now trigger a deployment when there currently isn't already one running. This ensures that any agents not yet running the current cluster will start to do so, and does nothing when those agents already run it, since they ignore the request in that case.
This commit is contained in:
parent
a622e28eab
commit
68558e2874
1 changed files with 14 additions and 1 deletions
|
@ -668,11 +668,24 @@ function deploy(req: Management::Request::Request)
|
||||||
event Management::Controller::API::notify_agents_ready(instances: set[string])
|
event Management::Controller::API::notify_agents_ready(instances: set[string])
|
||||||
{
|
{
|
||||||
local insts = Management::Util::set_to_vector(instances);
|
local insts = Management::Util::set_to_vector(instances);
|
||||||
|
local req: Management::Request::Request;
|
||||||
|
|
||||||
Management::Log::info(fmt("rx Management::Controller::API:notify_agents_ready %s",
|
Management::Log::info(fmt("rx Management::Controller::API:notify_agents_ready %s",
|
||||||
join_string_vec(insts, ", ")));
|
join_string_vec(insts, ", ")));
|
||||||
|
|
||||||
local req = Management::Request::lookup(g_config_reqid_pending);
|
# If we're not currently deploying a configuration, but have a deployed
|
||||||
|
# configuration, trigger a deployment at this point. Some of our agents
|
||||||
|
# might have restarted, and need to get in sync with us. Agents already
|
||||||
|
# running this configuration will do nothing.
|
||||||
|
if ( g_config_reqid_pending == "" && DEPLOYED in g_configs )
|
||||||
|
{
|
||||||
|
req = Management::Request::create();
|
||||||
|
req$deploy_state = DeployState($config=g_configs[DEPLOYED], $is_internal=T);
|
||||||
|
Management::Log::info(fmt("no deployment in progress, triggering via %s", req$id));
|
||||||
|
deploy(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
req = Management::Request::lookup(g_config_reqid_pending);
|
||||||
|
|
||||||
# If there's no pending request, when it's no longer available, or it
|
# If there's no pending request, when it's no longer available, or it
|
||||||
# doesn't have config state, don't do anything else.
|
# doesn't have config state, don't do anything else.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue