[PR #84] [MERGED] Improve logic to keep nodes up to date with the network state #1248

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

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/84
Author: @kradalby
Created: 8/13/2021
Status: Merged
Merged: 8/23/2021
Merged by: @juanfont

Base: mainHead: integration-tests-ci


📝 Commits (10+)

  • 0360616 initial integration test file
  • 7d1a5c0 Try with longer timeout
  • 6fa6138 Up client count, make arguments more explicit and clean up unused assignments
  • 2f88341 Add lastUpdate field to machine, function issue message on update channel
  • 57b79aa Set timeout, add lastupdate field
  • dd8c0d1 Move most "poll" functionality to poll.go
  • 8d1adaa Move isOutdated logic to updateChan consumation
  • 48ef6e5 Rename keepAlive function, as it now does more things
  • b0ec945 Make lastStateChange namespaced
  • 53168d5 Make http timeout 30s instead of 10s

📊 Changes

9 files changed (+648 additions, -259 deletions)

View changed files

.github/workflows/test-integration.yml (+23 -0)
📝 .gitignore (+2 -0)
📝 api.go (+7 -196)
📝 app.go (+37 -6)
📝 cmd/headscale/cli/utils.go (+1 -1)
📝 integration_test.go (+92 -26)
📝 integration_test/etc/config.json (+1 -1)
📝 machine.go (+112 -12)
📝 poll.go (+373 -17)

📄 Description

This PR is a two parter:

  • Hook up the integration tests
    • Checking that all nodes is a part of the tailscale status of all other nodes
    • Ping all nodes from each node directly
  • Fix the issues making the integration tests fail

This PR addresses a series of issues with the update logic making us able to ensure that nodes stay up to date when the network mesh changes. Previously it managed to push out changes sporadically and not consistently.

This is done by:

  • Ensuring updates are issued on omitPeer=true, stream=false (nodes use that to update their addresses)
  • Ensure the update channel actually is consumed by the stream function
  • Periodically issue an update request to all nodes

In addition, to not send excess amount of traffic to all nodes with unnecessary update, a simple "state" has been introduced with a timestamp the last time relevant changes was made. Updates will only be sent if the nodes have not had a successful update written to their long poll after the last update timestamp.

This PR should bring headscale and the integration tests into a state were we can reliably detect regressions that make the application not work as intended for our users :). Hopefully we can make changes with more confidence.


🔄 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/84 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 8/13/2021 **Status:** ✅ Merged **Merged:** 8/23/2021 **Merged by:** [@juanfont](https://github.com/juanfont) **Base:** `main` ← **Head:** `integration-tests-ci` --- ### 📝 Commits (10+) - [`0360616`](https://github.com/juanfont/headscale/commit/036061664ef1f1f97058a65eba1d97a82ef2cd20) initial integration test file - [`7d1a5c0`](https://github.com/juanfont/headscale/commit/7d1a5c00a099d103103be9312823a8f3651d61b7) Try with longer timeout - [`6fa6138`](https://github.com/juanfont/headscale/commit/6fa61380b25c522d43f4889993ee0ad55b432c5c) Up client count, make arguments more explicit and clean up unused assignments - [`2f88341`](https://github.com/juanfont/headscale/commit/2f883410d2a53f291979260810878d8f062b0771) Add lastUpdate field to machine, function issue message on update channel - [`57b79aa`](https://github.com/juanfont/headscale/commit/57b79aa852973bbc9ac3ab6a952061b83c1d008b) Set timeout, add lastupdate field - [`dd8c0d1`](https://github.com/juanfont/headscale/commit/dd8c0d1e9e2415247fc37414ed468ec25e8c5f37) Move most "poll" functionality to poll.go - [`8d1adaa`](https://github.com/juanfont/headscale/commit/8d1adaaef3abac891f6794c63268b5ac47c747e2) Move isOutdated logic to updateChan consumation - [`48ef6e5`](https://github.com/juanfont/headscale/commit/48ef6e5a6f492d80aae8e7467498b4053f11da58) Rename keepAlive function, as it now does more things - [`b0ec945`](https://github.com/juanfont/headscale/commit/b0ec945dbb59196b7542386a2a543ddf5ba987b9) Make lastStateChange namespaced - [`53168d5`](https://github.com/juanfont/headscale/commit/53168d54d803ef0c4a182ed6457a95e5681657e7) Make http timeout 30s instead of 10s ### 📊 Changes **9 files changed** (+648 additions, -259 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/test-integration.yml` (+23 -0) 📝 `.gitignore` (+2 -0) 📝 `api.go` (+7 -196) 📝 `app.go` (+37 -6) 📝 `cmd/headscale/cli/utils.go` (+1 -1) 📝 `integration_test.go` (+92 -26) 📝 `integration_test/etc/config.json` (+1 -1) 📝 `machine.go` (+112 -12) 📝 `poll.go` (+373 -17) </details> ### 📄 Description This PR is a two parter: - Hook up the integration tests - Checking that all nodes is a part of the `tailscale status` of all other nodes - Ping all nodes from each node directly - Fix the issues making the integration tests fail This PR addresses a series of issues with the update logic making us able to ensure that nodes stay up to date when the network mesh changes. Previously it managed to push out changes sporadically and not consistently. This is done by: - Ensuring updates are issued on omitPeer=true, stream=false (nodes use that to update their addresses) - Ensure the update channel actually is consumed by the stream function - Periodically issue an update request to all nodes In addition, to not send excess amount of traffic to all nodes with unnecessary update, a simple "state" has been introduced with a timestamp the last time relevant changes was made. Updates will only be sent if the nodes have not had a successful update written to their long poll after the last update timestamp. This PR should bring headscale and the integration tests into a state were we can reliably detect regressions that make the application not work as intended for our users :). Hopefully we can make changes with more confidence. --- <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:29:27 +01:00
adam closed this issue 2025-12-29 02:29:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1248