Package io.grpc.xds
Class ClusterResolverLoadBalancer
java.lang.Object
io.grpc.LoadBalancer
io.grpc.xds.ClusterResolverLoadBalancer
final class ClusterResolverLoadBalancer
extends io.grpc.LoadBalancer
Load balancer for cluster_resolver_experimental LB policy. This LB policy is the child LB policy
of the cds_experimental LB policy and the parent LB policy of the priority_experimental LB
policy in the xDS load balancing hierarchy. This policy resolves endpoints of non-aggregate
clusters (e.g., EDS or Logical DNS) and groups endpoints in priorities and localities to be
used in the downstream LB policies for fine-grained load balancing purposes.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private final class
The state of a cluster_resolver LB working session.private final class
Nested classes/interfaces inherited from class io.grpc.LoadBalancer
io.grpc.LoadBalancer.CreateSubchannelArgs, io.grpc.LoadBalancer.ErrorPicker, io.grpc.LoadBalancer.Factory, io.grpc.LoadBalancer.FixedResultPicker, io.grpc.LoadBalancer.Helper, io.grpc.LoadBalancer.PickDetailsConsumer, io.grpc.LoadBalancer.PickResult, io.grpc.LoadBalancer.PickSubchannelArgs, io.grpc.LoadBalancer.ResolvedAddresses, io.grpc.LoadBalancer.Subchannel, io.grpc.LoadBalancer.SubchannelPicker, io.grpc.LoadBalancer.SubchannelStateListener
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final io.grpc.internal.BackoffPolicy.Provider
private final io.grpc.util.GracefulSwitchLoadBalancer
private final io.grpc.LoadBalancerRegistry
private final XdsLogger
private static final Locality
private final io.grpc.SynchronizationContext
private final ScheduledExecutorService
private XdsClient
private io.grpc.internal.ObjectPool
<XdsClient> Fields inherited from class io.grpc.LoadBalancer
ATTR_HEALTH_CHECKING_CONFIG, DISABLE_SUBCHANNEL_RECONNECT_KEY, EMPTY_PICKER, HAS_HEALTH_PRODUCER_LISTENER_KEY, HEALTH_CONSUMER_LISTENER_ARG_KEY, IS_PETIOLE_POLICY
-
Constructor Summary
ConstructorsConstructorDescriptionClusterResolverLoadBalancer
(io.grpc.LoadBalancer.Helper helper) ClusterResolverLoadBalancer
(io.grpc.LoadBalancer.Helper helper, io.grpc.LoadBalancerRegistry lbRegistry, io.grpc.internal.BackoffPolicy.Provider backoffPolicyProvider) -
Method Summary
Modifier and TypeMethodDescriptionio.grpc.Status
acceptResolvedAddresses
(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses) private static io.grpc.util.OutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig
buildOutlierDetectionLbConfig
(EnvoyServerProtoData.OutlierDetection outlierDetection, Object childConfig) ConvertsEnvoyServerProtoData.OutlierDetection
that represents the xDS configuration toOutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig
that theOutlierDetectionLoadBalancer
understands.generateDnsBasedPriorityChildConfig
(String cluster, Bootstrapper.ServerInfo lrsServerInfo, Long maxConcurrentRequests, EnvoyServerProtoData.UpstreamTlsContext tlsContext, Map<String, com.google.protobuf.Struct> filterMetadata, io.grpc.LoadBalancerRegistry lbRegistry, List<Endpoints.DropOverload> dropOverloads) Generates the config to be used in the priority LB policy for the single priority of logical DNS cluster.generateEdsBasedPriorityChildConfigs
(String cluster, String edsServiceName, Bootstrapper.ServerInfo lrsServerInfo, Long maxConcurrentRequests, EnvoyServerProtoData.UpstreamTlsContext tlsContext, Map<String, com.google.protobuf.Struct> filterMetadata, EnvoyServerProtoData.OutlierDetection outlierDetection, Object endpointLbConfig, io.grpc.LoadBalancerRegistry lbRegistry, Map<String, Map<Locality, Integer>> prioritizedLocalityWeights, List<Endpoints.DropOverload> dropOverloads) Generates configs to be used in the priority LB policy for priorities in an EDS cluster.void
handleNameResolutionError
(io.grpc.Status error) private static String
localityName
(Locality locality) Generates a string that represents the locality in the LB policy config.private static String
priorityName
(String cluster, int priority) Generates a string that represents the priority in the LB policy config.void
shutdown()
Methods inherited from class io.grpc.LoadBalancer
canHandleEmptyAddressListFromNameResolution, handleResolvedAddresses, handleSubchannelState, requestConnection
-
Field Details
-
LOGICAL_DNS_CLUSTER_LOCALITY
-
logger
-
syncContext
private final io.grpc.SynchronizationContext syncContext -
timeService
-
lbRegistry
private final io.grpc.LoadBalancerRegistry lbRegistry -
backoffPolicyProvider
private final io.grpc.internal.BackoffPolicy.Provider backoffPolicyProvider -
delegate
private final io.grpc.util.GracefulSwitchLoadBalancer delegate -
xdsClientPool
-
xdsClient
-
config
-
-
Constructor Details
-
ClusterResolverLoadBalancer
ClusterResolverLoadBalancer(io.grpc.LoadBalancer.Helper helper) -
ClusterResolverLoadBalancer
ClusterResolverLoadBalancer(io.grpc.LoadBalancer.Helper helper, io.grpc.LoadBalancerRegistry lbRegistry, io.grpc.internal.BackoffPolicy.Provider backoffPolicyProvider)
-
-
Method Details
-
acceptResolvedAddresses
public io.grpc.Status acceptResolvedAddresses(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses) - Overrides:
acceptResolvedAddresses
in classio.grpc.LoadBalancer
-
handleNameResolutionError
public void handleNameResolutionError(io.grpc.Status error) - Specified by:
handleNameResolutionError
in classio.grpc.LoadBalancer
-
shutdown
public void shutdown()- Specified by:
shutdown
in classio.grpc.LoadBalancer
-
generateDnsBasedPriorityChildConfig
private static PriorityLoadBalancerProvider.PriorityLbConfig.PriorityChildConfig generateDnsBasedPriorityChildConfig(String cluster, @Nullable Bootstrapper.ServerInfo lrsServerInfo, @Nullable Long maxConcurrentRequests, @Nullable EnvoyServerProtoData.UpstreamTlsContext tlsContext, Map<String, com.google.protobuf.Struct> filterMetadata, io.grpc.LoadBalancerRegistry lbRegistry, List<Endpoints.DropOverload> dropOverloads) Generates the config to be used in the priority LB policy for the single priority of logical DNS cluster.priority LB -> cluster_impl LB (single hardcoded priority) -> pick_first
-
generateEdsBasedPriorityChildConfigs
private static Map<String,PriorityLoadBalancerProvider.PriorityLbConfig.PriorityChildConfig> generateEdsBasedPriorityChildConfigs(String cluster, @Nullable String edsServiceName, @Nullable Bootstrapper.ServerInfo lrsServerInfo, @Nullable Long maxConcurrentRequests, @Nullable EnvoyServerProtoData.UpstreamTlsContext tlsContext, Map<String, com.google.protobuf.Struct> filterMetadata, @Nullable EnvoyServerProtoData.OutlierDetection outlierDetection, Object endpointLbConfig, io.grpc.LoadBalancerRegistry lbRegistry, Map<String, Map<Locality, Integer>> prioritizedLocalityWeights, List<Endpoints.DropOverload> dropOverloads) Generates configs to be used in the priority LB policy for priorities in an EDS cluster.priority LB -> cluster_impl LB (one per priority) -> (weighted_target LB -> round_robin / least_request_experimental (one per locality)) / ring_hash_experimental
-
buildOutlierDetectionLbConfig
private static io.grpc.util.OutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig buildOutlierDetectionLbConfig(EnvoyServerProtoData.OutlierDetection outlierDetection, Object childConfig) ConvertsEnvoyServerProtoData.OutlierDetection
that represents the xDS configuration toOutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig
that theOutlierDetectionLoadBalancer
understands. -
priorityName
Generates a string that represents the priority in the LB policy config. The string is unique across priorities in all clusters and priorityName(c, p1) invalid input: '<' priorityName(c, p2) iff p1 invalid input: '<' p2. The ordering is undefined for priorities in different clusters. -
localityName
Generates a string that represents the locality in the LB policy config. The string is unique across all localities in all clusters.
-