Remove periodic pinging of controller by agents

This changes the agent-controller communication to remove the need for ongoing
pinging of the controller by agents not actively "in service". Instead, agents
now use the notify_agent_hello event to the controller to report only their
identity. The controller puts them into service via an agent_welcome_request/
response pair, and takes them out of service via agent_standby_request/response.

This removes the on_change handler from the set of agents that is ready for
service, because not every change to this set is now a suitable time to
potentially send out the configuration. We now invoke this check explicitly in
the two situations where it's warranted: when a agent reports ready for service,
and when we've received a new configuration.
This commit is contained in:
Christian Kreibich 2021-12-20 16:30:58 -08:00
parent 8463f14a52
commit ac40d5c5b2
3 changed files with 208 additions and 113 deletions

View file

@ -8,14 +8,35 @@ export {
# Agent API events
# The controller uses this event to convey a new cluster
# configuration to the agent. Once processed, the agent
# responds with the response event.
global set_configuration_request: event(reqid: string,
config: ClusterController::Types::Configuration);
global set_configuration_response: event(reqid: string,
result: ClusterController::Types::Result);
# The controller uses this event to confirm to the agent
# that it is part of the current cluster. The agent
# acknowledges with the response event.
global agent_welcome_request: event(reqid: string);
global agent_welcome_response: event(reqid: string,
result: ClusterController::Types::Result);
# The controller sends this event to convey that the agent is not
# currently required. This status may later change, depending on
# updates from the client, so the peering can remain active. The
# agent releases any cluster-related resources when processing the
# request.
global agent_standby_request: event(reqid: string);
global agent_standby_response: event(reqid: string,
result: ClusterController::Types::Result);
# Notification events, agent -> controller
# Report agent being available.
# The agent sends this upon peering as a "check in", informing the
# controller that an agent of the given name is now available to
# communicate with.
global notify_agent_hello: event(instance: string, host: addr,
api_version: count);
@ -30,11 +51,4 @@ export {
# Report informational message.
global notify_log: event(instance: string, msg: string, node: string &default="");
# Notification events, controller -> agent
# Confirmation from controller in response to notify_agent_hello
# that the agent is welcome.
global notify_controller_hello: event(controller: string, host: addr);
}