[PR #1017] [CLOSED] Refactor subnet router code and add support for subnet failover (HA) #1819

Closed
opened 2025-12-29 02:31:50 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/1017
Author: @juanfont
Created: 11/26/2022
Status: Closed

Base: mainHead: rerouting


📝 Commits (10+)

  • e88ff0f Add Route DB model
  • f4519ce Add migration from Machine.EnabledRoutes to the new Route table
  • 552f4bf Cleanup route.go and add helper methods to process HostInfo
  • ee9e64e Call processMachineRoutes when a new Map is received
  • 1dcc98f Remove EnabledRoutes from Machine and refactor to adapt to it
  • d71b802 Port routes tests to new model
  • 3da872b Mark as primary the first instance of subnet + tests
  • 940dbc7 Use helper methods in Machine
  • b376f58 Added method to perform subnet failover
  • 03accae Added tests for subnet failover

📊 Changes

20 files changed (+2330 additions, -1172 deletions)

View changed files

📝 api_common.go (+2 -2)
📝 app.go (+12 -0)
📝 cmd/headscale/cli/routes.go (+102 -102)
📝 db.go (+89 -2)
📝 gen/go/headscale/v1/headscale.pb.go (+130 -109)
📝 gen/go/headscale/v1/headscale.pb.gw.go (+410 -352)
📝 gen/go/headscale/v1/headscale_grpc.pb.go (+100 -28)
📝 gen/go/headscale/v1/routes.pb.go (+411 -116)
📝 gen/openapiv2/headscale/v1/headscale.swagger.json (+138 -62)
📝 grpcv1.go (+37 -12)
📝 integration/cli_test.go (+143 -0)
📝 integration_cli_test.go (+0 -193)
📝 machine.go (+146 -74)
📝 machine_test.go (+9 -2)
📝 proto/headscale/v1/headscale.proto (+18 -4)
📝 proto/headscale/v1/routes.proto (+35 -12)
📝 protocol_common_poll.go (+18 -1)
📝 routes.go (+282 -62)
📝 routes_test.go (+248 -29)
📝 utils.go (+0 -10)

📄 Description

This PR implements #988, for better route management.

Should also implement #1010, #260.

WIP


🔄 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/juanfont/headscale/pull/1017 **Author:** [@juanfont](https://github.com/juanfont) **Created:** 11/26/2022 **Status:** ❌ Closed **Base:** `main` ← **Head:** `rerouting` --- ### 📝 Commits (10+) - [`e88ff0f`](https://github.com/juanfont/headscale/commit/e88ff0f7d9dea6089d094616325da4d659f9eaaf) Add Route DB model - [`f4519ce`](https://github.com/juanfont/headscale/commit/f4519cecf5c005a14516bf32184a38f5f4f3cee8) Add migration from Machine.EnabledRoutes to the new Route table - [`552f4bf`](https://github.com/juanfont/headscale/commit/552f4bf19b783a570eaf5f9d917743406aff97d1) Cleanup route.go and add helper methods to process HostInfo - [`ee9e64e`](https://github.com/juanfont/headscale/commit/ee9e64e57b6023be9333546553c0907465834e7e) Call processMachineRoutes when a new Map is received - [`1dcc98f`](https://github.com/juanfont/headscale/commit/1dcc98fcbb9b227493e5c6e984e5e1ceb06b64f8) Remove EnabledRoutes from Machine and refactor to adapt to it - [`d71b802`](https://github.com/juanfont/headscale/commit/d71b802d817571f747ac353e3991dc4473bfd42e) Port routes tests to new model - [`3da872b`](https://github.com/juanfont/headscale/commit/3da872bb3096c7b9b4a2c07514d4baa7c25b793e) Mark as primary the first instance of subnet + tests - [`940dbc7`](https://github.com/juanfont/headscale/commit/940dbc77067e43ee6d632828a017f409efbadc9f) Use helper methods in Machine - [`b376f58`](https://github.com/juanfont/headscale/commit/b376f58e0edcfdec70be2d4c7090e6ad9f6f36aa) Added method to perform subnet failover - [`03accae`](https://github.com/juanfont/headscale/commit/03accae98c34613c3684660dc5dbef1b3060b57c) Added tests for subnet failover ### 📊 Changes **20 files changed** (+2330 additions, -1172 deletions) <details> <summary>View changed files</summary> 📝 `api_common.go` (+2 -2) 📝 `app.go` (+12 -0) 📝 `cmd/headscale/cli/routes.go` (+102 -102) 📝 `db.go` (+89 -2) 📝 `gen/go/headscale/v1/headscale.pb.go` (+130 -109) 📝 `gen/go/headscale/v1/headscale.pb.gw.go` (+410 -352) 📝 `gen/go/headscale/v1/headscale_grpc.pb.go` (+100 -28) 📝 `gen/go/headscale/v1/routes.pb.go` (+411 -116) 📝 `gen/openapiv2/headscale/v1/headscale.swagger.json` (+138 -62) 📝 `grpcv1.go` (+37 -12) 📝 `integration/cli_test.go` (+143 -0) 📝 `integration_cli_test.go` (+0 -193) 📝 `machine.go` (+146 -74) 📝 `machine_test.go` (+9 -2) 📝 `proto/headscale/v1/headscale.proto` (+18 -4) 📝 `proto/headscale/v1/routes.proto` (+35 -12) 📝 `protocol_common_poll.go` (+18 -1) 📝 `routes.go` (+282 -62) 📝 `routes_test.go` (+248 -29) 📝 `utils.go` (+0 -10) </details> ### 📄 Description This PR implements #988, for better route management. Should also implement #1010, #260. WIP --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 02:31:50 +01:00
adam closed this issue 2025-12-29 02:31:50 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1819