mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-25 00:51:28 +02:00
Once an endpoint hangs off a shared zone rather than a per-cluster address, subdomain labels must be unique across the whole zone rather than within one cluster. Uniqueness was previously advisory -- a pre-read "taken" set with no database constraint -- so this adds a unique index on the column and makes the database the arbiter. CreateAgentNetworkSettings is a plain INSERT that returns the driver error unwrapped, both of which the allocator depends on: SaveAgentNetworkSettings is an upsert (which cannot conflict) and wraps failures in a generic internal error, discarding the message that unique-violation detection needs. Note for operators: the index is created by a migration that fails, and therefore blocks startup, on a deployment that already holds two rows with the same subdomain on different clusters -- which was legal under the old per-cluster scheme. Audit for duplicates before upgrading.