Skip to content

Commit

Permalink
chore(xds): don't set deprecated dns_resolver_config (#4702)
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
  • Loading branch information
michaelbeaumont authored Aug 1, 2022
1 parent d841111 commit fb4dd71
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 28 deletions.
32 changes: 19 additions & 13 deletions pkg/xds/envoy/listeners/v3/dns_configurer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
envoy_listener "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
envoy_data_dns "github.com/envoyproxy/go-control-plane/envoy/data/dns/v3"
envoy_dns "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/udp/dns_filter/v3"
envoy_cares "github.com/envoyproxy/go-control-plane/envoy/extensions/network/dns_resolver/cares/v3"
"github.com/golang/protobuf/ptypes/any"

mesh_proto "github.com/kumahq/kuma/api/mesh/v1alpha1"
Expand Down Expand Up @@ -76,24 +77,29 @@ func (c *DNSConfigurer) dnsFilter() *envoy_dns.DnsFilterConfig {
}
sort.Stable(DnsTableByName(virtualDomains)) // for stable Envoy config

resolverConfig := envoy_cares.CaresDnsResolverConfig{
Resolvers: []*envoy_core.Address{
{
Address: &envoy_core.Address_SocketAddress{
SocketAddress: &envoy_core.SocketAddress{
Address: "127.0.0.1",
PortSpecifier: &envoy_core.SocketAddress_PortValue{
PortValue: c.EmptyDNSPort,
},
},
},
},
},
}

return &envoy_dns.DnsFilterConfig{
StatPrefix: "kuma_dns",
ClientConfig: &envoy_dns.DnsFilterConfig_ClientContextConfig{
// We configure upstream resolver to resolver that always returns that it could not find the domain (NXDOMAIN)
// As for this moment there is no setting to disable upstream resolving.
DnsResolutionConfig: &envoy_core.DnsResolutionConfig{
Resolvers: []*envoy_core.Address{
{
Address: &envoy_core.Address_SocketAddress{
SocketAddress: &envoy_core.SocketAddress{
Address: "127.0.0.1",
PortSpecifier: &envoy_core.SocketAddress_PortValue{
PortValue: c.EmptyDNSPort,
},
},
},
},
},
TypedDnsResolverConfig: &envoy_core.TypedExtensionConfig{
Name: "envoy.network.dns_resolver.cares",
TypedConfig: util_proto.MustMarshalAny(&resolverConfig),
},
MaxPendingLookups: 256,
},
Expand Down
13 changes: 8 additions & 5 deletions pkg/xds/envoy/listeners/v3/dns_configurer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ var _ = Describe("DNSConfigurer", func() {
'@type': type.googleapis.com/envoy.extensions.filters.udp.dns_filter.v3.DnsFilterConfig
clientConfig:
maxPendingLookups: "256"
dnsResolutionConfig:
resolvers:
- socketAddress:
address: 127.0.0.1
portValue: 53002
typedDnsResolverConfig:
name: envoy.network.dns_resolver.cares
typedConfig:
'@type': type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socketAddress:
address: 127.0.0.1
portValue: 53002
serverConfig:
inlineDnsTable:
virtualDomains:
Expand Down
13 changes: 8 additions & 5 deletions pkg/xds/generator/testdata/dns/1-envoy-config.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ resources:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.udp.dns_filter.v3.DnsFilterConfig
clientConfig:
dnsResolutionConfig:
resolvers:
- socketAddress:
address: 127.0.0.1
portValue: 53002
maxPendingLookups: "256"
typedDnsResolverConfig:
name: envoy.network.dns_resolver.cares
typedConfig:
'@type': type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socketAddress:
address: 127.0.0.1
portValue: 53002
serverConfig:
inlineDnsTable:
virtualDomains:
Expand Down
13 changes: 8 additions & 5 deletions pkg/xds/generator/testdata/dns/3-envoy-config.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ resources:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.udp.dns_filter.v3.DnsFilterConfig
clientConfig:
dnsResolutionConfig:
resolvers:
- socketAddress:
address: 127.0.0.1
portValue: 53002
maxPendingLookups: "256"
typedDnsResolverConfig:
name: envoy.network.dns_resolver.cares
typedConfig:
'@type': type.googleapis.com/envoy.extensions.network.dns_resolver.cares.v3.CaresDnsResolverConfig
resolvers:
- socketAddress:
address: 127.0.0.1
portValue: 53002
serverConfig:
inlineDnsTable:
virtualDomains:
Expand Down

0 comments on commit fb4dd71

Please sign in to comment.