feat: add "nearest.<service>.internal" mode to internal DNS (#159)

* feat: Adding a "nearest.service.local" mode to internal DNS

* Pass listenAddr to internal DNS server (rather than calling into network.MachineIP)

Also adds an exact round-robin via "rr.{service}" mode. Not sure we want that over random or not, though.

* Remove the resolved count and rotating round-robin. "rr.name" mode is now the same as default with random shuffle.

* Add test on nearest internal DNS lookup

* Add docs on internal DNS order modes
This commit is contained in:
Justin Bradford
2025-10-29 14:25:59 +10:00
committed by GitHub
parent 6af7a9861d
commit ba6290d616
4 changed files with 147 additions and 4 deletions
+6 -1
View File
@@ -430,7 +430,12 @@ func (m *Machine) Run(ctx context.Context) error {
}
dnsResolver := dns.NewClusterResolver(m.store)
dnsServer, err := dns.NewServer(m.IP(), dnsResolver, m.config.DNSUpstreams)
dnsServer, err := dns.NewServer(
m.IP(),
m.state.Network.Subnet,
dnsResolver,
m.config.DNSUpstreams,
)
if err != nil {
return fmt.Errorf("create embedded DNS server: %w", err)
}