Skip to content

Fix prefix health checks after config reloads#128

Merged
encodeous merged 2 commits into
encodeous:mainfrom
tionis:fix-changed-prefix-health-checks
Jul 2, 2026
Merged

Fix prefix health checks after config reloads#128
encodeous merged 2 commits into
encodeous:mainfrom
tionis:fix-changed-prefix-health-checks

Conversation

@tionis

@tionis tionis commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

This should fix prefix health-check handling during central config reloads.

Previously, Nylon reconciled advertised prefixes by prefix address only. If a config reload kept the same prefix but changed its health-check configuration, the prefix was treated as already active. Nylon then rewired the advertisement to the newly unmarshaled health-check object without starting it. For HTTP/ping health checks, that could leave the advertised metric at the object’s zero/default value instead of reflecting probe health.

Now, equivalent prefix health configs keep the existing running checker. Changed prefix health configs stop the old checker, start the new checker, and wire the advertisement to the running checker.

This matters for health-gated anycast prefixes distributed through central config updates. Without this fix, a provider can continue advertising a prefix as healthy after a reload even though the new health checker was never started.

Tests

  • Added regression coverage for changing an existing prefix to HTTP health.
  • Added regression coverage for equivalent reloads preserving the running health checker.
  • Ran go test ./core
  • Ran go test ./...
  • I did not run e2ee tests as I don't have a non-root docker setup on my machine.

Keep existing running prefix health checks when a config reload contains an equivalent prefix configuration. If the same prefix changes health config, stop the old checker and start the new one before wiring the advertisement.

This prevents config reloads from advertising a newly unmarshaled but unstarted health checker with its default metric.
Copilot AI review requested due to automatic review settings June 30, 2026 12:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes prefix health-check behavior across central config reloads by distinguishing “same prefix, same health config” from “same prefix, changed health config,” ensuring health check goroutines are started/stopped correctly and advertisements point at running checkers.

Changes:

  • Reworks reconcileAdvertisedPrefixes to reuse existing running prefix health checkers when the effective health-check configuration is unchanged, and to stop/start checkers when it changes.
  • Adds samePrefixHealthConfig (plus helpers) to compare health-check configs while accounting for tunable defaults.
  • Adds regression tests covering changed health-check configs starting correctly and unchanged configs reusing the running checker.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
core/nylon_apply.go Updates advertised-prefix reconciliation to preserve or restart prefix health checkers based on health config equivalence, and adds config-comparison helpers.
core/nylon_apply_test.go Adds tests validating correct start/reuse behavior of prefix health checkers during config reload reconciliation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/nylon_apply.go
@encodeous encodeous self-requested a review July 2, 2026 00:39
@encodeous

Copy link
Copy Markdown
Owner

Thanks for this PR!

@encodeous encodeous merged commit e6ad123 into encodeous:main Jul 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants