Add [master] config section to agent for registration

Heartbeat client now reads master connection settings from the agent
config ([master] section) with env var fallback. Includes address,
ca_cert, token_path, and role fields.

Agent's Run() creates and starts the heartbeat client automatically
when [master] is configured.

Tested on all three nodes: rift (master), svc (edge), orion (worker)
all registered with the master and sending heartbeats every 30s.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-04 13:53:15 -07:00
parent 6351b68ef6
commit 3b08caaa0a
3 changed files with 43 additions and 7 deletions

View File

@@ -19,7 +19,17 @@ type AgentConfig struct {
MCNS MCNSConfig `toml:"mcns"`
Monitor MonitorConfig `toml:"monitor"`
Log LogConfig `toml:"log"`
Boot BootConfig `toml:"boot"`
Boot BootConfig `toml:"boot"`
Master AgentMasterConfig `toml:"master"`
}
// AgentMasterConfig holds the optional master connection settings.
// When configured, the agent self-registers and sends heartbeats.
type AgentMasterConfig struct {
Address string `toml:"address"` // master gRPC address
CACert string `toml:"ca_cert"` // CA cert to verify master's TLS
TokenPath string `toml:"token_path"` // MCIAS service token for auth
Role string `toml:"role"` // "worker", "edge", or "master"
}
// BootConfig holds the boot sequence for the master node.