Management framework: augment deployed configs with instance IP addresses

The controller learns IP addresses from agents that peer with it, but that
information has so far gotten lost when resulting configs get pushed out to the
agents. This makes these updates include that information.
This commit is contained in:
Christian Kreibich 2024-07-05 17:22:27 -07:00
parent 742f7fe340
commit 8a4fb0ee19

View file

@ -186,6 +186,24 @@ 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 )