Documentation ¶
Index ¶
- Constants
- func EstablishConnection(name string, estimatorCache *SchedulerEstimatorCache, port int) error
- func GetReplicaEstimators() map[string]ReplicaEstimator
- func RegisterSchedulerEstimator(se *SchedulerEstimator)
- type GeneralEstimator
- type ReplicaEstimator
- type SchedulerEstimator
- type SchedulerEstimatorCache
- func (c *SchedulerEstimatorCache) AddCluster(name string, connection *grpc.ClientConn, client pb.EstimatorClient)
- func (c *SchedulerEstimatorCache) DeleteCluster(name string)
- func (c *SchedulerEstimatorCache) GetClient(name string) (pb.EstimatorClient, error)
- func (c *SchedulerEstimatorCache) IsEstimatorExist(name string) bool
Constants ¶
const UnauthenticReplica = -1
UnauthenticReplica is special replica number returned by estimator in case of estimator can't calculate the available replicas. The scheduler should discard the estimator's result and back-off to rely on other estimator's result.
Variables ¶
This section is empty.
Functions ¶
func EstablishConnection ¶
func EstablishConnection(name string, estimatorCache *SchedulerEstimatorCache, port int) error
EstablishConnection establishes a new gRPC connection with the specified cluster scheduler estimator.
func GetReplicaEstimators ¶
func GetReplicaEstimators() map[string]ReplicaEstimator
GetReplicaEstimators returns all replica estimators.
func RegisterSchedulerEstimator ¶
func RegisterSchedulerEstimator(se *SchedulerEstimator)
RegisterSchedulerEstimator will register a SchedulerEstimator.
Types ¶
type GeneralEstimator ¶
type GeneralEstimator struct{}
GeneralEstimator is a normal estimator in terms of cluster ResourceSummary.
func NewGeneralEstimator ¶
func NewGeneralEstimator() *GeneralEstimator
NewGeneralEstimator builds a new GeneralEstimator.
func (*GeneralEstimator) MaxAvailableReplicas ¶
func (ge *GeneralEstimator) MaxAvailableReplicas(ctx context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error)
MaxAvailableReplicas estimates the maximum replicas that can be applied to the target cluster by cluster ResourceSummary.
type ReplicaEstimator ¶
type ReplicaEstimator interface {
MaxAvailableReplicas(ctx context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error)
}
ReplicaEstimator is an estimator which estimates the maximum replicas that can be applied to the target cluster.
type SchedulerEstimator ¶
type SchedulerEstimator struct {
// contains filtered or unexported fields
}
SchedulerEstimator is an estimator that calls karmada-scheduler-estimator for estimation.
func NewSchedulerEstimator ¶
func NewSchedulerEstimator(cache *SchedulerEstimatorCache, timeout time.Duration) *SchedulerEstimator
NewSchedulerEstimator builds a new SchedulerEstimator.
func (*SchedulerEstimator) MaxAvailableReplicas ¶
func (se *SchedulerEstimator) MaxAvailableReplicas(parentCtx context.Context, clusters []*clusterv1alpha1.Cluster, replicaRequirements *workv1alpha2.ReplicaRequirements) ([]workv1alpha2.TargetCluster, error)
MaxAvailableReplicas estimates the maximum replicas that can be applied to the target cluster by calling karmada-scheduler-estimator.
type SchedulerEstimatorCache ¶
type SchedulerEstimatorCache struct {
// contains filtered or unexported fields
}
SchedulerEstimatorCache is a cache that stores gRPC clients of all the cluster accurate scheduler estimator.
func NewSchedulerEstimatorCache ¶
func NewSchedulerEstimatorCache() *SchedulerEstimatorCache
NewSchedulerEstimatorCache returns an accurate scheduler estimator cache.
func (*SchedulerEstimatorCache) AddCluster ¶
func (c *SchedulerEstimatorCache) AddCluster(name string, connection *grpc.ClientConn, client pb.EstimatorClient)
AddCluster adds a grpc connection and associated client into the cache.
func (*SchedulerEstimatorCache) DeleteCluster ¶
func (c *SchedulerEstimatorCache) DeleteCluster(name string)
DeleteCluster closes the connection and deletes it from the cache.
func (*SchedulerEstimatorCache) GetClient ¶
func (c *SchedulerEstimatorCache) GetClient(name string) (pb.EstimatorClient, error)
GetClient returns the gRPC client of a cluster accurate replica estimator.
func (*SchedulerEstimatorCache) IsEstimatorExist ¶
func (c *SchedulerEstimatorCache) IsEstimatorExist(name string) bool
IsEstimatorExist checks whether the cluster estimator exists in the cache.