feat(dns): add dual-stack DNS resolution with dnsdualstack+ scheme#8651
feat(dns): add dual-stack DNS resolution with dnsdualstack+ scheme#8651elidhu wants to merge 5 commits intothanos-io:mainfrom
Conversation
411292a to
7af0be1
Compare
|
Note that this is only useful for endpoint groups! |
pkg/discovery/dns/godns/resolver.go
Outdated
| select { | ||
| case <-ctx.Done(): | ||
| if len(result) > 0 { | ||
| return result, nil |
There was a problem hiding this comment.
If the deadline is exceeded then this can silently return partial results, right? That's probably not what the user expects. Probably worth just doing:
| return result, nil | |
| return nil, ctx.Err() |
There was a problem hiding this comment.
Also very observant, I notice the partial result pattern in miekgdns, but maybe that's different? -- I didn't look into it too much.
- Use --endpoint-group in docs (--store is deprecated), note endpoint-group context - Never return partial results on ctx cancellation (both godns and miekgdns) - Use package-level errNoSuchHost sentinel instead of hand-crafted net.DNSError - Remove dead code: IsDualStackNode (unused) - Fix CHANGELOG placeholder with actual PR number thanos-io#8651 - Update Resolver interface comment to include all qtypes - Fix misleading test: mock IsNotFound properly, split into not-found vs error paths Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
af04e8b to
b14daa8
Compare
- Use --endpoint-group in docs (--store is deprecated), note endpoint-group context - Never return partial results on ctx cancellation (both godns and miekgdns) - Use package-level errNoSuchHost sentinel instead of hand-crafted net.DNSError - Remove dead code: IsDualStackNode (unused) - Fix CHANGELOG placeholder with actual PR number thanos-io#8651 - Update Resolver interface comment to include all qtypes - Fix misleading test: mock IsNotFound properly, split into not-found vs error paths Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
- Use --endpoint-group in docs (--store is deprecated), note endpoint-group context - Never return partial results on ctx cancellation (both godns and miekgdns) - Use package-level errNoSuchHost sentinel instead of hand-crafted net.DNSError - Remove dead code: IsDualStackNode (unused) - Fix CHANGELOG placeholder with actual PR number thanos-io#8651 - Update Resolver interface comment to include all qtypes - Fix misleading test: mock IsNotFound properly, split into not-found vs error paths Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
4b13e0f to
c3c4fef
Compare
- Use --endpoint-group in docs (--store is deprecated), note endpoint-group context - Never return partial results on ctx cancellation (both godns and miekgdns) - Use package-level errNoSuchHost sentinel instead of hand-crafted net.DNSError - Remove dead code: IsDualStackNode (unused) - Fix CHANGELOG placeholder with actual PR number thanos-io#8651 - Update Resolver interface comment to include all qtypes - Fix misleading test: mock IsNotFound properly, split into not-found vs error paths Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
c3c4fef to
13ff0a8
Compare
|
I modified it slightly to pull out the common orchestration logic, preventing duplication in every single resolver. The interface still needed a new method Still addressed all original comments. Looks like some flaky tests? |
- Use --endpoint-group in docs (--store is deprecated), note endpoint-group context - Never return partial results on ctx cancellation (both godns and miekgdns) - Use package-level errNoSuchHost sentinel instead of hand-crafted net.DNSError - Remove dead code: IsDualStackNode (unused) - Fix CHANGELOG placeholder with actual PR number thanos-io#8651 - Update Resolver interface comment to include all qtypes - Fix misleading test: mock IsNotFound properly, split into not-found vs error paths Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
48c4940 to
5e78793
Compare
11cb5e6 to
1a6c0f4
Compare
Add dnsdualstack+ DNS scheme that resolves both A and AAAA records, enabling IPv4/IPv6 failover for store connections. Failover is handled automatically by gRPC's built-in health checking and round_robin balancer. Usage: --store=dnsdualstack+store.example.com:10901 Signed-off-by: Kevin Glasson <kglasson@cloudflare.com> Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
- Use --endpoint-group in docs (--store is deprecated), note endpoint-group context - Never return partial results on ctx cancellation (both godns and miekgdns) - Use package-level errNoSuchHost sentinel instead of hand-crafted net.DNSError - Remove dead code: IsDualStackNode (unused) - Fix CHANGELOG placeholder with actual PR number thanos-io#8651 - Update Resolver interface comment to include all qtypes - Fix misleading test: mock IsNotFound properly, split into not-found vs error paths Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
…work primitive Replace composed LookupIPAddrDualStack with primitive LookupIPAddrByNetwork on the ipLookupResolver interface. Dual-stack orchestration (iterate families, error handling) now lives in the parent resolver's ADualStack case. - godns: thin wrapper around net.Resolver.LookupIP - miekgdns: network-to-dns.Type mapping with CNAME recursion - Removed sort, dedup map, per-family counting from orchestration - Mock is now network-aware for realistic per-family test coverage Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
Signed-off-by: Kevin Glasson <kevinglasson@gmail.com>
1a6c0f4 to
cb22ea8
Compare
Add dnsdualstack+ DNS scheme that resolves both A and AAAA records, enabling IPv4/IPv6 failover for store connections. Failover is handled automatically by gRPC's built-in health checking and round_robin balancer.
Usage:
--store=dnsdualstack+store.example.com:10901
Changes
ADualStackresolver type that queries both A and AAAA DNS recordsLookupIPAddrDualStackto godns and miekgdns resolversdnsdualstack+scheme prefix for service discoveryVerification
go test ./pkg/discovery/dns/... -v- all tests passgo build ./cmd/thanos/...- builds clean