Requeue nodes when their tags change - #8
Open
jmeekhof wants to merge 1 commit into
Open
Conversation
nodesEqual compared name, online state and addresses, but not tags. Tags decide whether a node is managed at all via app.required_tags, so a node that gained or lost a relevant tag was never requeued unless one of its addresses happened to change at the same time. In practice that means tagging an existing device to bring it under dnsscale's management has no effect until the device's Tailscale address changes or the process restarts. Also switches the address comparison to slices.Equal, which is what the hand-rolled length check and loop were doing.
This was referenced Aug 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
nodesEqualcompares name, online state and addresses, but not tags:https://github.com/jaxxstorm/dnsscale/blob/main/main.go#L440
Tags are what decide whether a node is managed at all, via
shouldManageNodeandapp.required_tags. Because a tag change doesn't makenodesEqualreturn false,syncNodesnever requeues the node, so:Restarting is currently the reliable way to pick up a tag change, which is a surprising thing to need.
What changed
nodesEqualnow compares tags as well, and the hand-rolled length-check-plus-loop over addresses becomesslices.Equal, which is what it was already doing.One thing I noticed but did not change
Onlineis compared here, but nothing downstream uses it —shouldManageNodeandreconcileboth ignore it, so the records produced for an online and an offline node are identical. SinceOnlineis derived astime.Since(LastSeen) < 5*time.Minute, every device crossing that threshold requeues a reconcile that rewrites byte-identical records, which costs a provider API call per address per transition.That's arguably wasted work, but removing
Onlinefrom the comparison would foreclose gating on it later, so I've left it alone. Happy to strip it in a follow-up if you'd rather.Tests
Adds
nodes_test.gocovering the comparison, including tag added / removed / replaced.go build ./...,go vet ./...andgo test ./...all pass.