[PR #2034] [MERGED] Redo DNS configuration #2459

Closed
opened 2025-12-29 03:21:22 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2034
Author: @kradalby
Created: 7/26/2024
Status: Merged
Merged: 8/19/2024
Merged by: @kradalby

Base: mainHead: kradalby/redo-dns-config


📝 Commits (1)

📊 Changes

25 files changed (+1023 additions, -440 deletions)

View changed files

📝 .github/workflows/test-integration.yaml (+2 -1)
📝 CHANGELOG.md (+5 -2)
📝 cmd/headscale/headscale_test.go (+0 -35)
📝 config-example.yaml (+47 -40)
📝 flake.nix (+1 -1)
📝 go.mod (+11 -14)
📝 go.sum (+22 -29)
📝 hscontrol/mapper/tail.go (+1 -2)
📝 hscontrol/mapper/tail_test.go (+3 -1)
📝 hscontrol/noise.go (+1 -1)
📝 hscontrol/types/config.go (+225 -111)
hscontrol/types/config_test.go (+272 -0)
📝 hscontrol/types/node.go (+24 -25)
📝 hscontrol/types/node_test.go (+4 -4)
hscontrol/types/testdata/base-domain-in-server-url.yaml (+16 -0)
hscontrol/types/testdata/base-domain-not-in-server-url.yaml (+16 -0)
hscontrol/types/testdata/dns_full.yaml (+37 -0)
hscontrol/types/testdata/dns_full_no_magic.yaml (+37 -0)
hscontrol/types/testdata/minimal.yaml (+3 -0)
integration/dns_test.go (+246 -0)

...and 5 more files

📄 Description

This PR aims to redo (simplify and correct) DNS configuration to match what is possible with Tailscale.

TLDR: currently we have several settings that are either incompatible together, dont do what they sound like, or some dont work the way we thought at the time we, or a contributor implemented them.

DNS has been one of these things that mostly worked and had not been revisited until I got #1963 which I looked at, thought, I can easily knock this one out, and then I messed up everything. DNS config was very much a patchwork that had been changed over time and a lot of this work was from before we had integration tests.
It is embarrassing that it made it into the beta, but I suppose its a very efficient way to prioritise work...

This screwup has caused me to revisit the DNS config and I discovered that:

  • A lot of the settings is hard to understand what does
  • Some of them does not make sense in a Tailscale context
  • Some combination might not work at all.

Notable changes for people coming here from the CHANGELOG:

dns_config is now dns.

override_local_dns: has been removed, if magic_dns or the other dns options are used, Tailscale needs to take over the DNS configuration. Clients can opt out by passing --accept-dns=false (https://tailscale.com/kb/1235/resolv-conf)

domains has been renamed to search_domains to describe what it actually is.

nameservers has become a root key, where:
old nameservers is now nameservers.global and
restricted_nameservers is now nameservers.split to describe the fact that it was configuring Split DNS.

These settings now reflect what Tailscale (https://login.tailscale.com/admin/dns) allows you to do, but note, we still have some additional features like extra_records which has been preserved under the same key ;).

TODO:

  • Cobra can't read ENV vars for new config, breaking integration tests
  • more unit tests
  • more integration tests
  • updated CHANGELOG.md

Reverts DNS search path part of #1987

Fixes #2026
Fixes #2047
Fixes #1936
Fixes #2025
Fixes #2029
Updates #2024
Updates #1963


🔄 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/2034 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 7/26/2024 **Status:** ✅ Merged **Merged:** 8/19/2024 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/redo-dns-config` --- ### 📝 Commits (1) - [`3a098e5`](https://github.com/juanfont/headscale/commit/3a098e52e61111b7f7237f98482a2b4cf0c0bdaf) redo dns_config ### 📊 Changes **25 files changed** (+1023 additions, -440 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test-integration.yaml` (+2 -1) 📝 `CHANGELOG.md` (+5 -2) 📝 `cmd/headscale/headscale_test.go` (+0 -35) 📝 `config-example.yaml` (+47 -40) 📝 `flake.nix` (+1 -1) 📝 `go.mod` (+11 -14) 📝 `go.sum` (+22 -29) 📝 `hscontrol/mapper/tail.go` (+1 -2) 📝 `hscontrol/mapper/tail_test.go` (+3 -1) 📝 `hscontrol/noise.go` (+1 -1) 📝 `hscontrol/types/config.go` (+225 -111) ➕ `hscontrol/types/config_test.go` (+272 -0) 📝 `hscontrol/types/node.go` (+24 -25) 📝 `hscontrol/types/node_test.go` (+4 -4) ➕ `hscontrol/types/testdata/base-domain-in-server-url.yaml` (+16 -0) ➕ `hscontrol/types/testdata/base-domain-not-in-server-url.yaml` (+16 -0) ➕ `hscontrol/types/testdata/dns_full.yaml` (+37 -0) ➕ `hscontrol/types/testdata/dns_full_no_magic.yaml` (+37 -0) ➕ `hscontrol/types/testdata/minimal.yaml` (+3 -0) ➕ `integration/dns_test.go` (+246 -0) _...and 5 more files_ </details> ### 📄 Description This PR aims to redo (simplify and correct) DNS configuration to match what is possible with Tailscale. TLDR: currently we have several settings that are either incompatible together, dont do what they sound like, or some dont work the way we thought at the time we, or a contributor implemented them. DNS has been one of these things that _mostly worked_ and had not been revisited until I got #1963 which I looked at, thought, I can easily knock this one out, and then I _messed up everything_. DNS config was very much a patchwork that had been changed over time and a lot of this work was from before we had integration tests. It is embarrassing that it made it into the beta, but I suppose its a very efficient way to prioritise work... This screwup has caused me to revisit the DNS config and I discovered that: - A lot of the settings is hard to understand what does - Some of them does not make sense in a Tailscale context - Some combination might not work at all. **Notable changes for people coming here from the CHANGELOG**: `dns_config` is now `dns`. `override_local_dns`: has been removed, if magic_dns or the other dns options are used, Tailscale needs to take over the DNS configuration. Clients can opt out by passing `--accept-dns=false` (https://tailscale.com/kb/1235/resolv-conf) `domains` has been renamed to `search_domains` to describe what it actually is. `nameservers` has become a root key, where: old `nameservers` is now `nameservers.global` and `restricted_nameservers` is now `nameservers.split` to describe the fact that it was configuring Split DNS. These settings now reflect what Tailscale (https://login.tailscale.com/admin/dns) allows you to do, but note, we still have some additional features like `extra_records` which has been preserved under the same key ;). TODO: - [x] Cobra can't read ENV vars for new config, breaking integration tests - [x] more unit tests - [x] more integration tests - [x] updated CHANGELOG.md Reverts DNS search path part of #1987 Fixes #2026 Fixes #2047 Fixes #1936 Fixes #2025 Fixes #2029 Updates #2024 Updates #1963 --- <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 03:21:22 +01:00
adam closed this issue 2025-12-29 03:21:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2459