Skip to content

Commit 255a781

Browse files
committed
daemon: auto-assign pilot-<nodeID> hostname when none configured
Previously, a daemon started without Config.Hostname registered with no hostname at all — the operator had to run `pilotctl set-hostname` before anything could resolve the node by name. Most users skipped that step. This change defaults to `pilot-<8 lowercase hex of nodeID>` when Config.Hostname is empty: - Format matches the registry's hostname regex `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$` (14 chars, alphanumeric endpoints, only [a-z0-9-] inside). - Stable: the nodeID is the daemon's persistent identity, so the auto-default doesn't churn across restarts. - Unique: 32-bit nodeID is registry-allocated; collisions are impossible without an identity collision (which would prevent registration anyway). - Operator override: `pilotctl set-hostname <name>` still wins — setNodeHostname is a plain swap, no special case. The re-registration path (post-disconnect heal in pkg/daemon/daemon.go ~4249) gets the same treatment so a node's hostname survives a registry reconnection. Tests cover the format/stability invariant and a sweep against the duplicated registry regex (so the test fails loudly if the registry ever tightens validation in a way that would break the default).
1 parent 2144fca commit 255a781

2 files changed

Lines changed: 174 additions & 143 deletions

File tree

0 commit comments

Comments
 (0)