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 Classes Modifier and Type Class Description private static class
ClusterResolverLoadBalancer.ClusterResolutionResult
private class
ClusterResolverLoadBalancer.ClusterResolverLbState
The state of a cluster_resolver LB working session.private class
ClusterResolverLoadBalancer.ClusterResolverLbStateFactory
-
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
Fields Modifier and Type Field Description private io.grpc.internal.BackoffPolicy.Provider
backoffPolicyProvider
private ClusterResolverLoadBalancerProvider.ClusterResolverConfig
config
private io.grpc.util.GracefulSwitchLoadBalancer
delegate
private io.grpc.LoadBalancerRegistry
lbRegistry
private XdsLogger
logger
private static Locality
LOGICAL_DNS_CLUSTER_LOCALITY
private io.grpc.SynchronizationContext
syncContext
private java.util.concurrent.ScheduledExecutorService
timeService
private XdsClient
xdsClient
private io.grpc.internal.ObjectPool<XdsClient>
xdsClientPool
-
Constructor Summary
Constructors Constructor Description ClusterResolverLoadBalancer(io.grpc.LoadBalancer.Helper helper)
ClusterResolverLoadBalancer(io.grpc.LoadBalancer.Helper helper, io.grpc.LoadBalancerRegistry lbRegistry, io.grpc.internal.BackoffPolicy.Provider backoffPolicyProvider)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.grpc.Status
acceptResolvedAddresses(io.grpc.LoadBalancer.ResolvedAddresses resolvedAddresses)
private static io.grpc.util.OutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig
buildOutlierDetectionLbConfig(EnvoyServerProtoData.OutlierDetection outlierDetection, java.lang.Object childConfig)
ConvertsEnvoyServerProtoData.OutlierDetection
that represents the xDS configuration toOutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig
that theOutlierDetectionLoadBalancer
understands.private static PriorityLoadBalancerProvider.PriorityLbConfig.PriorityChildConfig
generateDnsBasedPriorityChildConfig(java.lang.String cluster, Bootstrapper.ServerInfo lrsServerInfo, java.lang.Long maxConcurrentRequests, EnvoyServerProtoData.UpstreamTlsContext tlsContext, java.util.Map<java.lang.String,com.google.protobuf.Struct> filterMetadata, io.grpc.LoadBalancerRegistry lbRegistry, java.util.List<Endpoints.DropOverload> dropOverloads)
Generates the config to be used in the priority LB policy for the single priority of logical DNS cluster.private static java.util.Map<java.lang.String,PriorityLoadBalancerProvider.PriorityLbConfig.PriorityChildConfig>
generateEdsBasedPriorityChildConfigs(java.lang.String cluster, java.lang.String edsServiceName, Bootstrapper.ServerInfo lrsServerInfo, java.lang.Long maxConcurrentRequests, EnvoyServerProtoData.UpstreamTlsContext tlsContext, java.util.Map<java.lang.String,com.google.protobuf.Struct> filterMetadata, EnvoyServerProtoData.OutlierDetection outlierDetection, java.lang.Object endpointLbConfig, io.grpc.LoadBalancerRegistry lbRegistry, java.util.Map<java.lang.String,java.util.Map<Locality,java.lang.Integer>> prioritizedLocalityWeights, java.util.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 java.lang.String
localityName(Locality locality)
Generates a string that represents the locality in the LB policy config.private static java.lang.String
priorityName(java.lang.String cluster, int priority)
Generates a string that represents the priority in the LB policy config.void
shutdown()
-
-
-
Field Detail
-
LOGICAL_DNS_CLUSTER_LOCALITY
private static final Locality LOGICAL_DNS_CLUSTER_LOCALITY
-
logger
private final XdsLogger logger
-
syncContext
private final io.grpc.SynchronizationContext syncContext
-
timeService
private final java.util.concurrent.ScheduledExecutorService 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
private io.grpc.internal.ObjectPool<XdsClient> xdsClientPool
-
xdsClient
private XdsClient xdsClient
-
config
private ClusterResolverLoadBalancerProvider.ClusterResolverConfig config
-
-
Constructor Detail
-
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 Detail
-
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(java.lang.String cluster, @Nullable Bootstrapper.ServerInfo lrsServerInfo, @Nullable java.lang.Long maxConcurrentRequests, @Nullable EnvoyServerProtoData.UpstreamTlsContext tlsContext, java.util.Map<java.lang.String,com.google.protobuf.Struct> filterMetadata, io.grpc.LoadBalancerRegistry lbRegistry, java.util.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 java.util.Map<java.lang.String,PriorityLoadBalancerProvider.PriorityLbConfig.PriorityChildConfig> generateEdsBasedPriorityChildConfigs(java.lang.String cluster, @Nullable java.lang.String edsServiceName, @Nullable Bootstrapper.ServerInfo lrsServerInfo, @Nullable java.lang.Long maxConcurrentRequests, @Nullable EnvoyServerProtoData.UpstreamTlsContext tlsContext, java.util.Map<java.lang.String,com.google.protobuf.Struct> filterMetadata, @Nullable EnvoyServerProtoData.OutlierDetection outlierDetection, java.lang.Object endpointLbConfig, io.grpc.LoadBalancerRegistry lbRegistry, java.util.Map<java.lang.String,java.util.Map<Locality,java.lang.Integer>> prioritizedLocalityWeights, java.util.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, java.lang.Object childConfig)
ConvertsEnvoyServerProtoData.OutlierDetection
that represents the xDS configuration toOutlierDetectionLoadBalancer.OutlierDetectionLoadBalancerConfig
that theOutlierDetectionLoadBalancer
understands.
-
priorityName
private static java.lang.String priorityName(java.lang.String cluster, int priority)
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) < priorityName(c, p2) iff p1 < p2. The ordering is undefined for priorities in different clusters.
-
localityName
private static java.lang.String localityName(Locality locality)
Generates a string that represents the locality in the LB policy config. The string is unique across all localities in all clusters.
-
-