grpc-go
grpc-go copied to clipboard
xdsclient: support multiple xDS clients [A71]
Currently, we have a global singleton xDS client object defined here: https://github.com/grpc/grpc-go/blob/bb0d32f07806ec84fc7a7bfeff73a5c3b53555bb/xds/internal/xdsclient/singleton.go#L103
As part of xDS client fallback [A71], we want to support multiple xDS client objects, keyed on the dial target for channels and a dedicated well-known key for servers.
We already maintain such a map of xDS client objects that is used only for testing purposes. This map is keyed on the bootstrap configuration to be used by the xDS client. See here for details. We would have to follow the same pattern to support multiple xDS client objects for fallback.
A bunch of functions would need to be modified to support this:
xdsclient.Newandxdslcient.NewWithConfigwould be modified to accept the key for the xDS client to be created As mentioned earlier, the key for xDS-enabled clients would be the dial target and the key for xDS-enabled servers would a well known string.xdsclient.NewWithConfigForTestingandxdsclient.NewWithBootstrapContentsForTestingwould need to be modified to use the same map as used by the non-testing functions