Management framework: move up addition of agent IPs into deployable cluster configs

Since the changes to port autoassignment in the preceding commits leverage agent
IP address information, we need to ensure that this information is available at
the time of autoassignment. The controller learns IP addresses from connecting
agents, and previously used that information at deploy time. This moves the
augmentation of the cluster config up to port autoassignment time.
This commit is contained in:
Christian Kreibich 2025-01-30 16:36:14 -08:00
parent 0c0769b1b2
commit ea88257d4d

View file

@ -186,24 +186,6 @@ global g_configs: table[ConfigState] of Management::Configuration
function config_deploy_to_agents(config: Management::Configuration, req: Management::Request::Request) function config_deploy_to_agents(config: Management::Configuration, req: Management::Request::Request)
{ {
# Make any final changes to the configuration we send off.
# If needed, fill in agent IP address info as learned from their peerings.
# XXX this will need revisiting when we support host names.
local instances: set[Management::Instance];
for ( inst in config$instances )
{
if ( inst$name in g_instances_known
&& inst$host == 0.0.0.0
&& g_instances_known[inst$name]$host != 0.0.0.0 )
inst$host = g_instances_known[inst$name]$host;
add instances[inst];
}
config$instances = instances;
for ( name in g_instances ) for ( name in g_instances )
{ {
if ( name !in g_instances_ready ) if ( name !in g_instances_ready )
@ -1037,6 +1019,27 @@ event Management::Controller::API::stage_configuration_request(reqid: string, co
g_configs[STAGED] = config; g_configs[STAGED] = config;
config_copy = copy(config); config_copy = copy(config);
# The staged config is preserved as the client sent it to us. For the
# ready-to-deploy version we fill in additional details here.
#
# One such bit of information is that we know the IP addresses of
# instances that connected to the controller from their Broker peering.
#
# XXX this will need revisiting when we support host names.
local instances: set[Management::Instance];
for ( inst in config_copy$instances )
{
if ( inst$name in g_instances_known
&& inst$host == 0.0.0.0
&& g_instances_known[inst$name]$host != 0.0.0.0 )
inst$host = g_instances_known[inst$name]$host;
add instances[inst];
}
config_copy$instances = instances;
if ( Management::Controller::auto_assign_broker_ports ) if ( Management::Controller::auto_assign_broker_ports )
config_assign_broker_ports(config_copy); config_assign_broker_ports(config_copy);
if ( Management::Controller::auto_assign_metrics_ports ) if ( Management::Controller::auto_assign_metrics_ports )