client

package
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
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(kubeClient kubernetes.Interface, name string, estimatorCache *SchedulerEstimatorCache, estimatorServicePrefix string, 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 GetUnschedulableReplicaEstimators added in v1.1.0

func GetUnschedulableReplicaEstimators() map[string]UnschedulableReplicaEstimator

GetUnschedulableReplicaEstimators returns all unschedulable 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(_ 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) GetUnschedulableReplicas added in v1.1.0

func (se *SchedulerEstimator) GetUnschedulableReplicas(
	parentCtx context.Context,
	clusters []string,
	reference *workv1alpha2.ObjectReference,
	unscheduableThreshold time.Duration,
) ([]workv1alpha2.TargetCluster, error)

GetUnschedulableReplicas gets the unschedulable replicas which belong to a specified workload by calling karmada-scheduler-estimator.

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 estimatorservice.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

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.

type UnschedulableReplicaEstimator added in v1.1.0

type UnschedulableReplicaEstimator interface {
	GetUnschedulableReplicas(ctx context.Context, clusters []string, reference *workv1alpha2.ObjectReference, unschedulableThreshold time.Duration) ([]workv1alpha2.TargetCluster, error)
}

UnschedulableReplicaEstimator is an estimator which estimates the unschedulable replicas which belong to a specified workload.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL