grpc-go icon indicating copy to clipboard operation
grpc-go copied to clipboard

csds: change the way csds retrieves the resource dump [A71]

Open easwars opened this issue 1 year ago • 0 comments

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 xds package 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 admin package 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 DumpResources method 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 xdsclient package 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 ClientConfig message per xDS client, and will populate the newly defined channel_target field in this message with the map key for the xDS client

easwars avatar Dec 28 '23 19:12 easwars