fix(inventory): route the whole pool through the hub from a spoke

A spoke's AllowedIPs for the hub was its own mesh subnet, so a worker on
10.100.0.0/24 had no route to the NFS server on 10.100.1.11 and could not
reach the plane it is deliberately not a member of -- which is the entire
reason the hub sits in both.

The symptom would have been misleading: every tunnel reports a healthy
handshake, the gate passes because it only pings peers the host is configured
for, and the failure surfaces later as an NFS mount that hangs. It points at
storage rather than at routing.

Spokes now route the declared pool through the hub while the hub keeps each
spoke pinned to a single address; routing the pool in both directions would
blackhole every member behind whichever spoke came first.

Found by running the writer against the prefixed five-host topology before the
deploy rather than during it.
This commit is contained in:
evangelostsak committed 2026-09-18 16:37:18 +02:00
1 parent ac0f08f181
commit 160b0eaff7
4 files changed
+44 -2

No files matched your search

@@ -157,6 +157,36 @@ class TestMeshShapeOnDisk(MeshOnDisk, unittest.TestCase):
self.assertIn("swarm:", text)
self.assertIn("data:", text)
def test_a_spoke_routes_the_whole_pool_through_the_hub(self):
"""A worker must reach the data plane it is not a member of.
Pinning a spoke's AllowedIPs to its own mesh subnet leaves the worker
with no route to the NFS server, and the mount fails while every tunnel
still reports a healthy handshake -- so the symptom points at storage
rather than at routing.
"""
self._write_all()
for spec in self.specs:
mesh = plan_mesh(spec, self.groups)
for spoke in mesh.spokes:
with self.subTest(mesh=spec.name, spoke=spoke.host):
peers = mesh.peers_of(spoke.host)
self.assertEqual([p.host for p in peers], [mesh.hub.host])
self.assertEqual(spec.routed_range, "10.100.0.0/16")
def test_the_hub_pins_each_spoke_to_a_single_address(self):
"""The inverse of the spoke rule.
A hub that routed the pool to one spoke would blackhole every other
member behind it.
"""
self._write_all()
for spec in self.specs:
mesh = plan_mesh(spec, self.groups)
for peer in mesh.peers_of(mesh.hub.host):
with self.subTest(mesh=spec.name, peer=peer.host):
self.assertFalse(peer.is_hub)
class TestIdempotence(MeshOnDisk, unittest.TestCase):
def test_a_second_run_leaves_every_file_byte_identical(self):