Update resolver defaulting

This commit is contained in:
freddygv 2020-09-03 13:08:44 -06:00
parent b149185794
commit 56fdae9ace
3 changed files with 6 additions and 8 deletions

View File

@ -2372,7 +2372,7 @@ func testcase_LBSplitterAndResolver() compileTestCase {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "foo.default.dc1", Name: "foo.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: false,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "foo.default.dc1", Target: "foo.default.dc1",
}, },
@ -2389,7 +2389,7 @@ func testcase_LBSplitterAndResolver() compileTestCase {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "bar.default.dc1", Name: "bar.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: false,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "bar.default.dc1", Target: "bar.default.dc1",
}, },
@ -2411,7 +2411,7 @@ func testcase_LBSplitterAndResolver() compileTestCase {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "baz.default.dc1", Name: "baz.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: false,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "baz.default.dc1", Target: "baz.default.dc1",
}, },
@ -2476,7 +2476,7 @@ func testcase_LBResolver() compileTestCase {
Type: structs.DiscoveryGraphNodeTypeResolver, Type: structs.DiscoveryGraphNodeTypeResolver,
Name: "main.default.dc1", Name: "main.default.dc1",
Resolver: &structs.DiscoveryResolver{ Resolver: &structs.DiscoveryResolver{
Default: true, Default: false,
ConnectTimeout: 5 * time.Second, ConnectTimeout: 5 * time.Second,
Target: "main.default.dc1", Target: "main.default.dc1",
}, },

View File

@ -730,7 +730,8 @@ func (e *ServiceResolverConfigEntry) IsDefault() bool {
len(e.Subsets) == 0 && len(e.Subsets) == 0 &&
e.Redirect == nil && e.Redirect == nil &&
len(e.Failover) == 0 && len(e.Failover) == 0 &&
e.ConnectTimeout == 0 e.ConnectTimeout == 0 &&
e.LoadBalancer == nil
} }
func (e *ServiceResolverConfigEntry) GetKind() string { func (e *ServiceResolverConfigEntry) GetKind() string {

View File

@ -82,9 +82,6 @@ func (c *CompiledDiscoveryChain) IsDefault() bool {
if !node.Resolver.Default { if !node.Resolver.Default {
return false return false
} }
if node.LoadBalancer != nil {
return false
}
target := c.Targets[node.Resolver.Target] target := c.Targets[node.Resolver.Target]