agents.default and agents.nodes.<id> in the cluster's settings hold everything agent.yaml can say but the agent's id, control planes, address and certificate, which stay in the file and are refused there. The control plane sends each node its settings on register and, a second apart, when they change; an agent whose settings changed checks they load beside its file, keeps them and starts again on them, engines serving throughout. An edited agent.yaml that loads restarts the agent too. History, audit, ctl config, the console and the portal's settings page cover them as the rest of the settings. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
29 lines
821 B
Go
29 lines
821 B
Go
package agentsvc
|
|
|
|
import (
|
|
"log/slog"
|
|
"testing"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/control/inventory"
|
|
)
|
|
|
|
func TestEachNodeIsToldItsOwnAgentSettings(t *testing.T) {
|
|
s := New(inventory.NewStore(), nil, false, slog.New(slog.DiscardHandler))
|
|
if s.agentSettingsMsg("n1") != nil {
|
|
t.Error("told settings with nothing to read them from")
|
|
}
|
|
s.SetAgentSettings(func(node string) string {
|
|
if node == "cuda01" {
|
|
return "labels:\n gpu: rtx6000\n"
|
|
}
|
|
return ""
|
|
})
|
|
if got := s.agentSettingsMsg("cuda01").GetAgentSettings().GetYaml(); got != "labels:\n gpu: rtx6000\n" {
|
|
t.Errorf("cuda01 told %q", got)
|
|
}
|
|
// None is said too, so an agent whose settings were removed drops them.
|
|
if m := s.agentSettingsMsg("node01"); m == nil || m.GetAgentSettings().GetYaml() != "" {
|
|
t.Errorf("node01 told %v", m)
|
|
}
|
|
}
|