Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional random node suffixes. #766

Closed
shanna opened this issue Aug 25, 2022 · 2 comments · Fixed by #771
Closed

Optional random node suffixes. #766

shanna opened this issue Aug 25, 2022 · 2 comments · Fixed by #771
Labels
enhancement New feature or request

Comments

@shanna
Copy link

shanna commented Aug 25, 2022

The random node suffixes introduced in 0.16.0 mean machines onboarded with preauth keys end up on random MagicDNS hostnames. My use case is I generate preauth keys and unique hostnames for devices during provisioning programatically and I'd like for my software to be able to resolve the hostnames later within the namespace's subdomain.

I've got a branch here that implements the change though I thought I better create a ticket first before submitting a PR since this may generate some discussion.

  • I think suffixes should be off by default but YMMV. It does revert the new default prefixes introduced in 0.16.0 and I have no idea what Tailscale does by default. 🤷
  • The other ways this could be solved is by setting a node name in advance when you create a preauth key via the API or by honouring the --hostname tailscale cli flag? No idea how difficult these options would be to implement but I'm happy to have a crack if you'd rather not introduce another configuration variable.
@shanna shanna added the enhancement New feature or request label Aug 25, 2022
@kradalby
Copy link
Collaborator

This change was introduced as we had behaviour that would put the MagicDNS in a conflicting state, two or more machines in could try to have the same DNS, while it might not be the optimal solution, it is needed to be implemented over a broken configuration.

It isn't sufficient to have an option to revert the behaviour as it will allow users to end up in a state with unexpected and indeterministic behaviour. The core argument for this is support load, and potential other weirdness.

I think improving the behaviour would be the way to go.
My initial thought would be that when ever a machine is registered/updated/renamed, the database is checked for the machine + namespace combination to verify it is unique, if it is unique, the suffix is not applied, effectively restoring the behaviour in most of the cases.

@shanna
Copy link
Author

shanna commented Aug 31, 2022

OK. I've created a new PR that only applies a suffix if the given name collides with another machine in the same namespace.

@kradalby kradalby added this to the v0.17.0 milestone Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants