google-c2p resolver: add authority entry to bootstrap config (#5680)

This commit is contained in:
apolcyn
2022-10-24 14:21:47 -07:00
committed by GitHub
parent 9127159caf
commit 26071c24f3
2 changed files with 23 additions and 11 deletions

View File

@ -110,14 +110,20 @@ func (c2pResolverBuilder) Build(t resolver.Target, cc resolver.ClientConn, opts
if balancerName == "" {
balancerName = tdURL
}
serverConfig := &bootstrap.ServerConfig{
ServerURI: balancerName,
Creds: grpc.WithCredentialsBundle(google.NewDefaultCredentials()),
TransportAPI: version.TransportV3,
NodeProto: newNode(<-zoneCh, <-ipv6CapableCh),
}
config := &bootstrap.Config{
XDSServer: &bootstrap.ServerConfig{
ServerURI: balancerName,
Creds: grpc.WithCredentialsBundle(google.NewDefaultCredentials()),
TransportAPI: version.TransportV3,
NodeProto: newNode(<-zoneCh, <-ipv6CapableCh),
},
XDSServer: serverConfig,
ClientDefaultListenerResourceNameTemplate: "%s",
Authorities: map[string]*bootstrap.Authority{
"traffic-director-c2p.xds.googleapis.com": {
XDSServer: serverConfig,
},
},
}
// Create singleton xds client with this config. The xds client will be

View File

@ -211,13 +211,19 @@ func TestBuildXDS(t *testing.T) {
},
}
}
serverConfig := &bootstrap.ServerConfig{
ServerURI: tdURL,
TransportAPI: version.TransportV3,
NodeProto: wantNode,
}
wantConfig := &bootstrap.Config{
XDSServer: &bootstrap.ServerConfig{
ServerURI: tdURL,
TransportAPI: version.TransportV3,
NodeProto: wantNode,
},
XDSServer: serverConfig,
ClientDefaultListenerResourceNameTemplate: "%s",
Authorities: map[string]*bootstrap.Authority{
"traffic-director-c2p.xds.googleapis.com": {
XDSServer: serverConfig,
},
},
}
if tt.tdURI != "" {
wantConfig.XDSServer.ServerURI = tt.tdURI