mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-08-31 08:57:14 +02:00
Let fleet members find their peers without any central lookup call. FleetPublisher reads the active-service roster and publishes, per bucket (each cluster plus the reserved "infra" bucket) and per consumer service type, the pre-filtered set of providers that type should discover. A subscriber listens on exactly one subject, cc.fleet.discovery.<cluster|infra>.<own-service-type>, and gets a ready-to-use list. Rosters are re-published periodically because NATS core pub/sub is fire-and-forget, so a service that subscribes late still converges. The publish function is injected rather than taken from the NATS client directly, so the component has no hard broker dependency and is unit testable without one; the wiring layer supplies nats.GetClient().Publish. ProviderInfo is the entire on-wire shape and deliberately carries no instance_id (the registration credential), no config content and no config_revision: the discovery subjects have no application-layer auth, so anything published there is readable by every subscriber. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>