xds: Allow child of cluster_impl LB to change (1.54.x backport) #10103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of #10091
Under normal conditions the child LB ofClusterImplLoadBalancer
does not fluctuate, based on the field used to configure load balancing in the xDSCluster
proto it is either:1.WrrLocalityLoadBalancer
if the newerload_balancing_policy
field is used2.
WeightedTargetLoadBalancer
if the legacylb_policy
field is used(The premise set here is off, see comment)
ClusterImplLoadBalancer
currently assumes that this child does not change and so does not change the child LB when the name resolver sends an update. If the control plane does switch to using a different field for LB config, that update will have an LB config meant for the other child LB type. This will result in a ClassCastException and a channel panic.To address this,
ClusterImplLoadBalancer
will now useGracefulSwitchLoadBalancer
and makes sure if the child policy changes the correct LB implementation is switched to.Closes #10006