binder

package
v0.0.0-...-6111fc0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPreemptionBackoffPeriodInSeconds = 600
	MaxRetryAttempts                    = 3 // TODO: 5 will cause a timeout in UT (30s)
)

Variables

View Source
var ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")

ErrNoNodesAvailable is used to describe the error that no nodes available to schedule pods.

Functions

func BindPhase

func BindPhase(
	ctx context.Context,
	handler handle.BinderFrameworkHandle,
	rui *runningUnitInfo,
) *framework.Status

func CheckConflictPhase

func CheckConflictPhase(
	ctx context.Context,
	rui *runningUnitInfo,
	nInfo framework.NodeInfo,
) *framework.Status

func CheckPreemptionPhase

func CheckPreemptionPhase(
	ctx context.Context,
	rui *runningUnitInfo,
	commonState *framework.CycleState,
) (returnStatus *framework.Status)

TODO: re-implement...

func CheckTopologyPhase

func CheckTopologyPhase(
	ctx context.Context,
	rui *runningUnitInfo,
	commonState *framework.CycleState,
	nInfo framework.NodeInfo,
) *framework.Status

func DefaultQueueSortFunc

func DefaultQueueSortFunc() framework.LessFunc

DefaultQueueSortFunc returns the function to sort pods in scheduling queue

func DefaultUnitQueueSortFunc

func DefaultUnitQueueSortFunc() framework.UnitLessFunc

func IsPreemptionComplete

func IsPreemptionComplete(podLister corelisters.PodLister, victimPods framework.VictimPods) bool

func MakeDefaultErrorFunc

func MakeDefaultErrorFunc(client clientset.Interface, podLister corelisters.PodLister, podQueue queue.BinderQueue, binderCache godelcache.BinderCache) func(*framework.QueuedPodInfo, error)

MakeDefaultErrorFunc construct a function to handle pod scheduler error

func NewBasePlugins

func NewBasePlugins(victimsCheckingPlugins []*framework.VictimCheckingPluginCollectionSpec) *apis.BinderPluginCollection

func NewBindingUnitInfo

func NewBindingUnitInfo(unit *framework.QueuedUnitInfo) *bindingUnitInfo

func NewFrameworkHandle

func NewFrameworkHandle(
	client clientset.Interface,
	crdClient godelclient.Interface,
	informerFactory informers.SharedInformerFactory,
	crdInformerFactory crdinformers.SharedInformerFactory,
	options binderOptions,
	binderCache godelcache.BinderCache, volumeBindingTimeoutSeconds int64,
) handle.BinderFrameworkHandle

func ValidateUnit

func ValidateUnit(unit *framework.QueuedUnitInfo) error

Types

type APICallFailedTask

type APICallFailedTask struct {
	// contains filtered or unexported fields
}

type Binder

type Binder struct {
	// SchedulerName here is the higher level scheduler name, which is used to select pods
	// that godel schedulers should be responsible for and filter out irrelevant pods.
	SchedulerName *string
	// Close this to shut down the scheduler.
	StopEverything <-chan struct{}

	// It is expected that changes made via BinderCache will be observed
	// by NodeLister and Algorithm.
	BinderCache godelcache.BinderCache
	// BinderQueue holds pods which have nominated nodes and
	// need to resolve conflicts
	BinderQueue queue.BinderQueue

	// NextPod should be a function that blocks until the next pod
	// is available. We don't use a channel for this, because scheduling
	// a pod may take some amount of time, and we don't want pods to get
	// stale while they sit in a channel.
	NextUnit func() *framework.QueuedUnitInfo
	// Error is called if there is an error. It is passed the pod in
	// question, and the error
	Error func(*framework.QueuedPodInfo, error)
	// contains filtered or unexported fields
}

Binder watches for assumed pods from multiple schedulers, and binds pods if no conflicts, otherwise, rejects the pods.

func New

func New(
	client clientset.Interface,
	crdClient godelclient.Interface,
	informerFactory informers.SharedInformerFactory,
	crdInformerFactory crdinformers.SharedInformerFactory,
	katalystCrdInformerFactory katalystinformers.SharedInformerFactory,
	stopCh <-chan struct{},
	recorder events.EventRecorder,
	schedulerName *string,
	volumeBindingTimeoutSeconds int64,
	reservationTTL time.Duration,
	opts ...Option,
) (*Binder, error)

New returns a Binder

func (*Binder) CheckAndBindUnit

func (binder *Binder) CheckAndBindUnit(ctx context.Context) bool

func (*Binder) CheckCrossNodePreemptionForUnit

func (binder *Binder) CheckCrossNodePreemptionForUnit(ctx context.Context, unitInfo *bindingUnitInfo) error

func (*Binder) CheckCrossNodeTopologyForUnit

func (binder *Binder) CheckCrossNodeTopologyForUnit(ctx context.Context, unitInfo *bindingUnitInfo) error

func (*Binder) CheckSameNodeConflictsForUnit

func (binder *Binder) CheckSameNodeConflictsForUnit(ctx context.Context, unitInfo *bindingUnitInfo) error

func (*Binder) DeleteVictimsAndBindTasks

func (binder *Binder) DeleteVictimsAndBindTasks(ctx context.Context, unitInfo *bindingUnitInfo) error

all tasks (in ready and waiting list) are assumed (new tasks are also added to cache) when coming here

func (*Binder) FailAndRejectAllTasks

func (binder *Binder) FailAndRejectAllTasks(unitInfo *bindingUnitInfo, err error)

TODO: emit events ?

func (*Binder) InitializeUnit

func (binder *Binder) InitializeUnit(unit *framework.QueuedUnitInfo) *bindingUnitInfo

func (*Binder) MarkVictimsAndAssumeTasks

func (binder *Binder) MarkVictimsAndAssumeTasks(ctx context.Context, unitInfo *bindingUnitInfo) error

func (*Binder) ReEnqueueWaitingTasks

func (binder *Binder) ReEnqueueWaitingTasks(unitInfo *bindingUnitInfo)

func (*Binder) RejectFailedTasks

func (binder *Binder) RejectFailedTasks(unitInfo *bindingUnitInfo)

TODO: figure out what can we do if fail to reject tasks

func (*Binder) RejectTimeOutUnit

func (binder *Binder) RejectTimeOutUnit(unit *framework.QueuedUnitInfo)

func (*Binder) Run

func (binder *Binder) Run(ctx context.Context)

Run begins watching and scheduling. It waits for cache to be synced, then starts scheduling and blocked until the context is done.

func (*Binder) UnitTimeout

func (binder *Binder) UnitTimeout(unit *framework.QueuedUnitInfo) bool

type BinderTasksReconciler

type BinderTasksReconciler struct {
	APICallFailedTaskQueue workqueue.RateLimitingInterface
	// contains filtered or unexported fields
}

func NewBinderTaskReconciler

func NewBinderTaskReconciler(client clientset.Interface) *BinderTasksReconciler

func (*BinderTasksReconciler) APICallFailedWorker

func (btr *BinderTasksReconciler) APICallFailedWorker()

func (*BinderTasksReconciler) AddFailedTask

func (btr *BinderTasksReconciler) AddFailedTask(ft *APICallFailedTask)

func (*BinderTasksReconciler) Close

func (btr *BinderTasksReconciler) Close()

func (*BinderTasksReconciler) Run

func (btr *BinderTasksReconciler) Run()

type FailedReason

type FailedReason string
const (
	RejectFailed FailedReason = "RejectFailed"
)

type Option

type Option func(*binderOptions)

Option configures a Scheduler

func WithPluginsAndConfigs

func WithPluginsAndConfigs(profile *config.GodelBinderProfile) Option

WithPluginsAndConfigs sets Preemption Plugins and Configs, the default value is nil

type TaskSetGroupByNode

type TaskSetGroupByNode struct {
	// nodes that tasks are scheduled to
	Nodes sets.String

	// first key is node name, value are tasks scheduled to that node
	// second is pod UID
	Tasks map[string]map[types.UID]*runningUnitInfo
	// first key is node name, value are victims on that node
	// second key is pod UID
	VictimsGroupByNode map[string]map[types.UID]*v1.Pod
}

Jump to

Keyboard shortcuts

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