Add explicit peer kind support to Management API#6434
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughIntroduces a ChangesPeer Kind Classification
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|



Describe your changes
This PR adds explicit peer kind support to the Management API so peers can be classified as
auto,device, orserver.Today, the dashboard has to infer peer type from enrollment behavior: peers enrolled with setup keys are treated as servers, and peers enrolled through SSO are treated as user devices. That inference is probably correct for most installations most of the time, but it is not always true. Some setup-key peers are regular devices, and some SSO-enrolled peers may function as servers, shared infrastructure, or unattended systems. Using enrollment method as the only source of truth makes the implementation clunky and limits the dashboard’s ability to represent the user’s actual environment.
This PR keeps the current behavior compatible by making
autothe default value. Inautomode, dashboards and clients can continue using the existing inference logic. Newer dashboards can optionally let users override the classification by settingkindtodeviceorserver.Changes included:
Kindfield in the management server model.auto,device, andserver.auto.kindfield on existing peer records.kindin peer list and single-peer API responses.kindupdates through the peer update API.This is intended to support the companion dashboard change that restores the combined Peers page and allows the UI to respect explicit peer type when the backend provides it.
Issue ticket number and link
Supports dashboard issue: netbirdio/dashboard#663
Supports dashboard PR: netbirdio/dashboard#668
Issue #663 reports that the split Peers UI reduced functionality by forcing users to move between separate User Devices and Servers pages instead of working from one complete peer list. This API change addresses the underlying classification limitation that made the split awkward: the existing server/device distinction is inferred from enrollment method, which is useful as a default but not always accurate.
Stack
Companion dashboard PR: netbirdio/dashboard#668
Checklist
Because this adds a public REST API field, I left the public API checklist item unchecked unless maintainers consider the linked dashboard issue/PR sufficient prior discussion.
Documentation
Select exactly one:
This change adds a small Management API field used by the dashboard to classify peers as automatic, device, or server. It does not introduce a new setup flow, operator configuration step, CLI flag, or user-facing self-hosting procedure. The dashboard companion PR presents the relevant behavior directly in the UI through the Peers page controls and peer detail field.
Docs PR URL (required if "docs added" is checked)
Paste the PR link from https://github.com/netbirdio/docs here:
https://github.com/netbirdio/docs/pull/__
Summary by CodeRabbit