Repository navigation
feat(serve): remove a destroyed host's tailnet device and rename it with the host - #72
Merged
Merged
Conversation
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.
berth now removes a host's device from the tailnet when it destroys the host's machine. When a host is renamed with
--hostname, berth renames the device too.tailnetkind, next toaccess: its stable id (Tailscale'snodeId, or Headscale's node number), MagicDNS name and addresses. The role reads them fromtailscale status --jsonintoapplied.json, and berth reads that back through berthd at the end of the apply. Rename moves the record, forget drops it, and a duplicate starts without one.remove destroy=yesdeletes the device once the provisioner has destroyed the machine. A missing key, a refused key or a device that is already gone is reported in the job. The host is forgotten anyway. Removing without destroy leaves the device alone.hostname=yesmarks the device to be renamed. The next apply does the rename, after the machine has taken the new hostname. That way berth can still reach the host by its old MagicDNS name for that apply, and the name on the tailnet changes at the same time as the machine's. If the profile's address is the old name, berth changes it to the new one. A rename that is refused waits for the next apply.The scopes are checked against Tailscale's API docs. Deleting and renaming need
devices:core. Listing needsdevices:core:read, whichdevices:coreincludes. Making keys still needsauth_keys. Headscale API keys have no scopes. The access page and the refusal messages say this.Everything was tested against fake Tailscale and Headscale servers and a local berthd, never against a real control server.