grpc-go
grpc-go copied to clipboard
csds: change the way csds retrieves the resource dump [A71]
CSDS service implementation in gRPC can be found here: https://github.com/grpc/grpc-go/blob/master/xds/csds/csds.go. It is registered through the following code path:
- Importing the
xdspackage results in the CSDS service being added to the list of admin services in the internal admin package. See: https://github.com/grpc/grpc-go/blob/4f03f3ff32c983f2e9b030889041ff9d5ffb6aeb/xds/xds.go#L52C9-L52C9 - Importing the external
adminpackage and invoking the Register method leads to registering of all admin services added to the internal admin package
Current CSDS service implementation does the following:
- Creates a new xDS client at creation time. See: https://github.com/grpc/grpc-go/blob/4f03f3ff32c983f2e9b030889041ff9d5ffb6aeb/xds/csds/csds.go#L70
- To service the unary and streaming methods that it exposes, it invokes the
DumpResourcesmethod on the xDS client. See https://github.com/grpc/grpc-go/blob/4f03f3ff32c983f2e9b030889041ff9d5ffb6aeb/xds/csds/csds.go#L122 - Converts the resource dump received from the xDS client into the appropriate protobuf response message. See https://github.com/grpc/grpc-go/blob/4f03f3ff32c983f2e9b030889041ff9d5ffb6aeb/xds/csds/csds.go#L141
Changes required to support A71:
- Add a function in the
xdsclientpackage to return a resource dump from all xDS clients. - Change the CSDS service implementation to not bother creating an xDS client at creation time and closing the same at closing time. Instead use the above newly defined function to retrieve the resource dump.
- The above newly defined function should return a map with the key being the key used in the xDS client map, and the value being the resource dump from that particular xDS client.
- CSDS service will create one
ClientConfigmessage per xDS client, and will populate the newly definedchannel_targetfield in this message with the map key for the xDS client