-
Notifications
You must be signed in to change notification settings - Fork 955
Introduce virtual host snapshots #6105
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
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.
👍 👍 👍
|
||
@Override | ||
void doOnChanged(VirtualHostXdsResource resource) { | ||
pending.clear(); |
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.
In RouteResourceNode
, we call virtualHostSnapshots.clear();
where as we call pending.clear();
here. Is this intentional?
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.
Good point, updated both implementations to just clear both data structures
xds/src/main/java/com/linecorp/armeria/xds/VirtualHostXdsResource.java
Outdated
Show resolved
Hide resolved
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.
Mostly nits. Looks good!
xds/src/main/java/com/linecorp/armeria/xds/ClusterResourceNode.java
Outdated
Show resolved
Hide resolved
xds/src/main/java/com/linecorp/armeria/xds/RouteResourceNode.java
Outdated
Show resolved
Hide resolved
xds/src/main/java/com/linecorp/armeria/xds/VirtualHostSnapshot.java
Outdated
Show resolved
Hide resolved
xds/src/main/java/com/linecorp/armeria/xds/client/endpoint/XdsAttributeKeys.java
Outdated
Show resolved
Hide resolved
Let me go ahead and merge this PR, thanks for the review all |
Motivation:
We are planning on deprecating
XdsEndpointGroup
and introducingXdsPreprocessor
at #6096.Previously,
XdsEndpointGroup
created sub-EndpointGroup
s which consume resources. (e.g.HealthCheckedEndpointGroup
,DnsEndpointGroup
, etc..) assuming that all xDS clients will share a commonEndpointGroup
.However,
XdsPreprocessor
cannot be shared among all client types.For instance, thrift clients will need to use
RpcPreprocessor
whereas web clients will need to use normalPreprocessor
s.I propose that
XdsBootstrap
contains a singleClusterManager
which caches allEndpointGroup
s derived fromCluster
s. ThisClusterManager
is aligned with the xDS API cluster_manager and is aligned with the upstream implementation as well.One prerequisite for the introduction of
ClusterManager
is the ability to cacheCluster
s. This is difficult since the current implementation ofClusterSnapshot
also contains a reference to the containingRoute
.armeria/xds/src/main/java/com/linecorp/armeria/xds/ClusterSnapshot.java
Line 82 in 533f798
I propose that
VirtualHostSnapshot
andRouteEntry
is introduced, and snapshot mappings are unidirectional. This direction aligns with a possible future implementation of VHDS as well.As this is a refactor of the previous implementation, there is no expected change in behavior except for subset load balancing (which actually matches upstream now)
Modifications:
VirtualHostSnapshot
which is equivalent toVirtualHost
, andRouteEntry
which is equivalent toRoute
.ClusterManager
andSubsetLoadBalancer
to not useClusterSnapshot#route
SubsetLoadBalancer
now is aligned with the upstream implementation (ref)ConfigSourceMapper
implementation by removing unused fields and the corresponding logic.Result:
ClusterSnapshot
API is prepared for the introduction of a centralClusterManager
maintained byXdsBootstrapImpl