Name the machines a failing network part points at in the node's health report, so the watchman holds it where the controller does (issue 774)

delivery.NetworkPart.Targets (mesh-sdk 6eae076) is filled where the report is made, by the controller's own rule:
- the hub's node for "hub";
- each resolver's node by its address on the private network;
- none when the part points at nothing, at this machine, or at an address no other mesh machine has.

The names come from the placements the node's own composer holds (Decided.Address, Decided.Hub). A spoke's tunnel names
only the hub, so the tunnel cannot name a resolver on another spoke. A node that does not compose its own names no
target.

Test: rows in TestAHealthStatementIsSaidOnTheLinkOpenNow (hub, two resolvers, a VPN's resolver, its own, a healthy
part).
This commit is contained in:
2026-10-29 23:05:02 +01:00
parent 3ed9abf658
commit c3ff18de4e
7 changed files with 98 additions and 11 deletions
+18
View File
@@ -423,6 +423,24 @@ func (c *Composer) takeModuleHave(u agent.Update) bool {
}
// inOwnOf is, of the modules p places, those the node runs inside its own composition (c.inOwn), sorted; c.mu held.
// Machines is, from the placements this composer holds, each node by its address on the private network, and the hub's
// node: what names the machine a failing network part points at (delivery.NetworkPart.Targets, issue 774). Empty
// before any placement is read.
func (c *Composer) Machines() (byAddress map[string]string, hub string) {
c.mu.Lock()
defer c.mu.Unlock()
byAddress = map[string]string{}
for node, p := range c.placements {
if a, _, _ := strings.Cut(p.Decided.Address, "/"); a != "" {
byAddress[a] = node
}
if p.Decided.Hub {
hub = node
}
}
return byAddress, hub
}
func (c *Composer) inOwnOf(p delivery.Placement) []string {
var out []string
for _, m := range p.Modules {