[PR #5628] [MERGED] [management, proxy] Add require_subdomain capability for proxy clusters #28260

Closed
opened 2026-08-05 08:06:03 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/5628
Author: @lixmal
Created: 3/19/2026
Status: Merged
Merged: 3/20/2026
Merged by: @lixmal

Base: mainHead: feature/require-subdomain-validation


📝 Commits (4)

  • 2910e7e Add require_subdomain capability for proxy clusters
  • 81f2e63 Fix missing ClusterRequireSubdomain on proxy integration test mock
  • ffa26ab Prefer longest custom domain match and validate subdomain on every update
  • f759ea0 Extract transaction body from persistServiceUpdate to reduce cognitive complexity

📊 Changes

19 files changed (+413 additions, -46 deletions)

View changed files

📝 management/internals/modules/reverseproxy/domain/domain.go (+3 -0)
📝 management/internals/modules/reverseproxy/domain/manager/api.go (+1 -0)
management/internals/modules/reverseproxy/domain/manager/domain_test.go (+172 -0)
📝 management/internals/modules/reverseproxy/domain/manager/manager.go (+15 -5)
📝 management/internals/modules/reverseproxy/proxy/manager.go (+1 -0)
📝 management/internals/modules/reverseproxy/proxy/manager/controller.go (+6 -0)
📝 management/internals/modules/reverseproxy/proxy/manager_mock.go (+14 -0)
📝 management/internals/modules/reverseproxy/service/manager/l4_port_test.go (+1 -0)
📝 management/internals/modules/reverseproxy/service/manager/manager.go (+62 -36)
📝 management/internals/modules/reverseproxy/service/manager/manager_test.go (+66 -0)
📝 management/internals/shared/grpc/proxy.go (+29 -0)
📝 management/internals/shared/grpc/proxy_test.go (+4 -0)
📝 proxy/cmd/proxy/cmd/root.go (+3 -0)
📝 proxy/management_integration_test.go (+4 -0)
📝 proxy/server.go (+5 -0)
📝 shared/management/http/api/openapi.yml (+4 -0)
📝 shared/management/http/api/types.gen.go (+3 -0)
📝 shared/management/proto/proxy_service.pb.go (+17 -5)
📝 shared/management/proto/proxy_service.proto (+3 -0)

📄 Description

Describe your changes

  • Add require_subdomain field to ProxyCapabilities proto and ReverseProxyDomain API response
  • Proxy clusters can now report whether bare cluster domain usage is allowed
  • When require_subdomain=true, service creation/update rejects domain == cluster_domain
  • Allow custom domains to be used bare (without subdomain) via extractClusterFromCustomDomains
  • Add server-side validation in both create and update paths
  • Add --require-subdomain / NB_PROXY_REQUIRE_SUBDOMAIN flag to proxy binary (default false)

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Configuration is via proxy flag/env var, no user-facing docs needed.

Summary by CodeRabbit

  • New Features

    • Clusters can advertise a "require subdomain" capability so services must use subdomain labels instead of bare cluster domains.
    • API now exposes a require_subdomain flag and a CLI/server option to configure/query this behavior.
  • Bug Fixes & Validation

    • Management now validates and rejects bare-domain service creation/updates when the cluster requires a subdomain.
  • Other

    • Improved custom-domain matching to select the most specific domain match.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/5628 **Author:** [@lixmal](https://github.com/lixmal) **Created:** 3/19/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@lixmal](https://github.com/lixmal) **Base:** `main` ← **Head:** `feature/require-subdomain-validation` --- ### 📝 Commits (4) - [`2910e7e`](https://github.com/netbirdio/netbird/commit/2910e7e01a25adff3c40bb7010589bfb0bc35b00) Add require_subdomain capability for proxy clusters - [`81f2e63`](https://github.com/netbirdio/netbird/commit/81f2e63e424cb046f1bc7b65959ed2718ed729c1) Fix missing ClusterRequireSubdomain on proxy integration test mock - [`ffa26ab`](https://github.com/netbirdio/netbird/commit/ffa26aba1c6a96e755ccf4e51aaa8e7bd5f85a6e) Prefer longest custom domain match and validate subdomain on every update - [`f759ea0`](https://github.com/netbirdio/netbird/commit/f759ea0926cec041a0d5e92615641a85af102f82) Extract transaction body from persistServiceUpdate to reduce cognitive complexity ### 📊 Changes **19 files changed** (+413 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `management/internals/modules/reverseproxy/domain/domain.go` (+3 -0) 📝 `management/internals/modules/reverseproxy/domain/manager/api.go` (+1 -0) ➕ `management/internals/modules/reverseproxy/domain/manager/domain_test.go` (+172 -0) 📝 `management/internals/modules/reverseproxy/domain/manager/manager.go` (+15 -5) 📝 `management/internals/modules/reverseproxy/proxy/manager.go` (+1 -0) 📝 `management/internals/modules/reverseproxy/proxy/manager/controller.go` (+6 -0) 📝 `management/internals/modules/reverseproxy/proxy/manager_mock.go` (+14 -0) 📝 `management/internals/modules/reverseproxy/service/manager/l4_port_test.go` (+1 -0) 📝 `management/internals/modules/reverseproxy/service/manager/manager.go` (+62 -36) 📝 `management/internals/modules/reverseproxy/service/manager/manager_test.go` (+66 -0) 📝 `management/internals/shared/grpc/proxy.go` (+29 -0) 📝 `management/internals/shared/grpc/proxy_test.go` (+4 -0) 📝 `proxy/cmd/proxy/cmd/root.go` (+3 -0) 📝 `proxy/management_integration_test.go` (+4 -0) 📝 `proxy/server.go` (+5 -0) 📝 `shared/management/http/api/openapi.yml` (+4 -0) 📝 `shared/management/http/api/types.gen.go` (+3 -0) 📝 `shared/management/proto/proxy_service.pb.go` (+17 -5) 📝 `shared/management/proto/proxy_service.proto` (+3 -0) </details> ### 📄 Description ## Describe your changes - Add `require_subdomain` field to `ProxyCapabilities` proto and `ReverseProxyDomain` API response - Proxy clusters can now report whether bare cluster domain usage is allowed - When `require_subdomain=true`, service creation/update rejects `domain == cluster_domain` - Allow custom domains to be used bare (without subdomain) via `extractClusterFromCustomDomains` - Add server-side validation in both create and update paths - Add `--require-subdomain` / `NB_PROXY_REQUIRE_SUBDOMAIN` flag to proxy binary (default false) ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [x] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) Configuration is via proxy flag/env var, no user-facing docs needed. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Clusters can advertise a "require subdomain" capability so services must use subdomain labels instead of bare cluster domains. * API now exposes a require_subdomain flag and a CLI/server option to configure/query this behavior. * **Bug Fixes & Validation** * Management now validates and rejects bare-domain service creation/updates when the cluster requires a subdomain. * **Other** * Improved custom-domain matching to select the most specific domain match. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:06:03 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#28260