Skip to content

Commit 99fc16f

Browse files
committed
resolving comments
1 parent fa04dda commit 99fc16f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

internal/xds/balancer/cdsbalancer/e2e_test/dns_impl_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2025 gRPC authors.
2+
* Copyright 2026 gRPC authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

internal/xds/balancer/clusterresolver/configbuilder.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ func buildClusterImplConfigForDNS(g *nameGenerator, endpoints []resolver.Endpoin
154154
}
155155
var retEndpoint resolver.Endpoint
156156
for _, e := range endpoints {
157-
// Copy the nested address field as slice fields are shared by the
158-
// iteration variable and the original slice.
157+
// LOGICAL_DNS requires all resolved addresses to be grouped into a
158+
// single logical endpoint. We iterate over the input endpoints and
159+
// aggregate their addresses into a new endpoint variable.
159160
retEndpoint.Addresses = append(retEndpoint.Addresses, e.Addresses...)
160161
}
161162
// Even though localities are not a thing for the LOGICAL_DNS cluster and
@@ -167,7 +168,7 @@ func buildClusterImplConfigForDNS(g *nameGenerator, endpoints []resolver.Endpoin
167168
// Set the locality weight to 1. This is required because the child policy
168169
// like wrr which relies on locality weights to distribute traffic. These
169170
// policies may drop traffic if the weight is 0.
170-
retEndpoint = wrrlocality.SetAddrInfoInEndpoint(retEndpoint, wrrlocality.AddrInfo{LocalityWeight: 1})
171+
retEndpoint = wrrlocality.SetAddrInfo(retEndpoint, wrrlocality.AddrInfo{LocalityWeight: 1})
171172
return pName, lbconfig, []resolver.Endpoint{retEndpoint}
172173
}
173174

internal/xds/balancer/clusterresolver/configbuilder_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func testEndpointForDNS(endpoints []resolver.Endpoint, localityWeight uint32, pa
314314
retEndpoint.Addresses = append(retEndpoint.Addresses, e.Addresses...)
315315
}
316316
retEndpoint = hierarchy.SetInEndpoint(retEndpoint, path)
317-
retEndpoint = wrrlocality.SetAddrInfoInEndpoint(retEndpoint, wrrlocality.AddrInfo{LocalityWeight: localityWeight})
317+
retEndpoint = wrrlocality.SetAddrInfo(retEndpoint, wrrlocality.AddrInfo{LocalityWeight: localityWeight})
318318
return retEndpoint
319319
}
320320

@@ -363,7 +363,7 @@ func (s) TestBuildClusterImplConfigForDNS(t *testing.T) {
363363
} {
364364
t.Run(tt.name, func(t *testing.T) {
365365
gotName, gotConfig, gotEndpoints := buildClusterImplConfigForDNS(newNameGenerator(3), tt.endpoints, DiscoveryMechanism{Cluster: testClusterName2, Type: DiscoveryMechanismTypeLogicalDNS}, tt.xdsLBPolicy)
366-
wantName := "priority-3"
366+
const wantName = "priority-3"
367367
if diff := cmp.Diff(gotName, wantName); diff != "" {
368368
t.Errorf("buildClusterImplConfigForDNS() diff (-got +want) %v", diff)
369369
}

0 commit comments

Comments
 (0)