Skip to content

Commit

Permalink
xds/bootstrap: refactor to support top level and per-authority server…
Browse files Browse the repository at this point in the history
… config (#4892)
  • Loading branch information
menghanl committed Nov 2, 2021
1 parent 1163cfa commit 29deb6b
Show file tree
Hide file tree
Showing 12 changed files with 384 additions and 251 deletions.
2 changes: 1 addition & 1 deletion xds/csds/csds.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (s *ClientStatusDiscoveryServer) buildClientStatusRespForReq(req *v3statusp
ret := &v3statuspb.ClientStatusResponse{
Config: []*v3statuspb.ClientConfig{
{
Node: nodeProtoToV3(s.xdsClient.BootstrapConfig().NodeProto),
Node: nodeProtoToV3(s.xdsClient.BootstrapConfig().XDSServer.NodeProto),
GenericXdsConfigs: configs,
},
},
Expand Down
10 changes: 6 additions & 4 deletions xds/googledirectpath/googlec2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,12 @@ func (c2pResolverBuilder) Build(t resolver.Target, cc resolver.ClientConn, opts
balancerName = tdURL
}
config := &bootstrap.Config{
BalancerName: balancerName,
Creds: grpc.WithCredentialsBundle(google.NewDefaultCredentials()),
TransportAPI: version.TransportV3,
NodeProto: newNode(<-zoneCh, <-ipv6CapableCh),
XDSServer: &bootstrap.ServerConfig{
ServerURI: balancerName,
Creds: grpc.WithCredentialsBundle(google.NewDefaultCredentials()),
TransportAPI: version.TransportV3,
NodeProto: newNode(<-zoneCh, <-ipv6CapableCh),
},
}

// Create singleton xds client with this config. The xds client will be
Expand Down
13 changes: 8 additions & 5 deletions xds/googledirectpath/googlec2p_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,18 @@ func TestBuildXDS(t *testing.T) {
}
}
wantConfig := &bootstrap.Config{
BalancerName: tdURL,
TransportAPI: version.TransportV3,
NodeProto: wantNode,
XDSServer: &bootstrap.ServerConfig{
ServerURI: tdURL,
TransportAPI: version.TransportV3,
NodeProto: wantNode,
},
}
if tt.tdURI != "" {
wantConfig.BalancerName = tt.tdURI
wantConfig.XDSServer.ServerURI = tt.tdURI
}
cmpOpts := cmp.Options{
cmpopts.IgnoreFields(bootstrap.Config{}, "Creds"),
cmpopts.IgnoreFields(bootstrap.ServerConfig{}, "Creds"),
cmp.AllowUnexported(bootstrap.ServerConfig{}),
protocmp.Transform(),
}
select {
Expand Down
Loading

0 comments on commit 29deb6b

Please sign in to comment.