-
Notifications
You must be signed in to change notification settings - Fork 3.9k
xds: generic xds client #9444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xds: generic xds client #9444
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review is still WIP, here's what I have so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good enough to me; it is big and we can do tweaks later. Except for the thread-safety of getInstance()
; that needs to be fixed before it goes in.
private String rdsVersion = ""; | ||
private String cdsVersion = ""; | ||
private String edsVersion = ""; | ||
private final Map<ResourceType, String> versions = new HashMap<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, it looks trivial to use XdsResourceType
as the key here (and the other map with ResourceType as the key). I did see the TODO for ResourceType, and that's okay, I just noticed those two maps seemed trivial.
)" This reverts commit e1ad984.
Mainly refactor work to make type specific xds resources generic, e.g. 1. Define abstract class XdsResourceType to be extended by pluggable new resources. It mainly contains abstract method doParse() to parse unpacked proto messges and produce a ResourceUpdate. The common unpacking proto logic is in XdsResourceType default method parse() 2. Move the parsing/processing logics to specific XdsResourceType. Implementing: XdsListenerResource for LDS XdsRouteConfigureResource for RDS XdsClusterResource for CDS XdsEndpointResource for EDS 3. The XdsResourceTypes are singleton. To process for each XdsClient, context is passed in parameters, defined by XdsResourceType.Args. 4. Watchers will use generic APIs to subscribe to resource watchXdsResource(XdsResourceType, resourceName, watcher). Watcher and ResourceSubscribers becomes java generic class.
Get rid of type specific xds resources but making it generic, e.g.
XdsResourceType
to be extended by pluggable new resources. It mainly contains abstract methoddoParse()
to parse unpacked proto messges and produce aResourceUpdate
. The common unpacking proto logic is inXdsResourceType
default methodparse()
XdsResourceType
. Implementing:XdsListenerResource
for LDSXdsRouteConfigureResource
for RDSXdsClusterResource
for CDSXdsEndpointResource
for EDSXdsResourceType
s are singleton. To process for eachXdsClient
, context is passed in parameters, defined byXdsResourceType.Args
.watchXdsResource(XdsResourceType, resourceName, watcher)
. Watcher and ResourceSubscribers becomes java generic class.