core

package
v1.20.15 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultExtenderTimeout defines the default extender timeout in second.
	DefaultExtenderTimeout = 5 * time.Second
)
View Source
const (
	// NoNodeAvailableMsg is used to format message when no nodes available.
	NoNodeAvailableMsg = "0/%v nodes are available"
)

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 Equal added in v1.17.0

func Equal(e1, e2 *HTTPExtender) bool

Equal is used to check if two extenders are equal ignoring the client field, exported for testing

func NewHTTPExtender

func NewHTTPExtender(config *schedulerapi.Extender) (framework.Extender, error)

NewHTTPExtender creates an HTTPExtender object.

func PodPassesFiltersOnNode added in v1.19.0

func PodPassesFiltersOnNode(
	ctx context.Context,
	ph framework.PreemptHandle,
	state *framework.CycleState,
	pod *v1.Pod,
	info *framework.NodeInfo,
) (bool, *framework.Status, error)

PodPassesFiltersOnNode checks whether a node given by NodeInfo satisfies the filter plugins. This function is called from two different places: Schedule and Preempt. When it is called from Schedule, we want to test whether the pod is schedulable on the node with all the existing pods on the node plus higher and equal priority pods nominated to run on the node. When it is called from Preempt, we should remove the victims of preemption and add the nominated pods. Removal of the victims is done by SelectVictimsOnNode(). Preempt removes victims from PreFilter state and NodeInfo before calling this function. TODO: move this out so that plugins don't need to depend on <core> pkg.

Types

type FitError

type FitError struct {
	Pod                   *v1.Pod
	NumAllNodes           int
	FilteredNodesStatuses framework.NodeToStatusMap
}

FitError describes a fit error of a pod.

func (*FitError) Error

func (f *FitError) Error() string

Error returns detailed information of why the pod failed to fit on each node

type HTTPExtender

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

HTTPExtender implements the Extender interface.

func (*HTTPExtender) Bind

func (h *HTTPExtender) Bind(binding *v1.Binding) error

Bind delegates the action of binding a pod to a node to the extender.

func (*HTTPExtender) Filter

func (h *HTTPExtender) Filter(
	pod *v1.Pod,
	nodes []*v1.Node,
) ([]*v1.Node, extenderv1.FailedNodesMap, error)

Filter based on extender implemented predicate functions. The filtered list is expected to be a subset of the supplied list; otherwise the function returns an error. failedNodesMap optionally contains the list of failed nodes and failure reasons.

func (*HTTPExtender) IsBinder

func (h *HTTPExtender) IsBinder() bool

IsBinder returns whether this extender is configured for the Bind method.

func (*HTTPExtender) IsIgnorable added in v1.11.0

func (h *HTTPExtender) IsIgnorable() bool

IsIgnorable returns true indicates scheduling should not fail when this extender is unavailable

func (*HTTPExtender) IsInterested

func (h *HTTPExtender) IsInterested(pod *v1.Pod) bool

IsInterested returns true if at least one extended resource requested by this pod is managed by this extender.

func (*HTTPExtender) Name added in v1.13.0

func (h *HTTPExtender) Name() string

Name returns extenderURL to identify the extender.

func (*HTTPExtender) Prioritize

func (h *HTTPExtender) Prioritize(pod *v1.Pod, nodes []*v1.Node) (*extenderv1.HostPriorityList, int64, error)

Prioritize based on extender implemented priority functions. Weight*priority is added up for each such priority function. The returned score is added to the score computed by Kubernetes scheduler. The total score is used to do the host selection.

func (*HTTPExtender) ProcessPreemption added in v1.11.0

func (h *HTTPExtender) ProcessPreemption(
	pod *v1.Pod,
	nodeNameToVictims map[string]*extenderv1.Victims,
	nodeInfos framework.NodeInfoLister,
) (map[string]*extenderv1.Victims, error)

ProcessPreemption returns filtered candidate nodes and victims after running preemption logic in extender.

func (*HTTPExtender) SupportsPreemption added in v1.11.0

func (h *HTTPExtender) SupportsPreemption() bool

SupportsPreemption returns true if an extender supports preemption. An extender should have preempt verb defined and enabled its own node cache.

type ScheduleAlgorithm added in v1.14.0

type ScheduleAlgorithm interface {
	Schedule(context.Context, framework.Framework, *framework.CycleState, *v1.Pod) (scheduleResult ScheduleResult, err error)
	// Extenders returns a slice of extender config. This is exposed for
	// testing.
	Extenders() []framework.Extender
}

ScheduleAlgorithm is an interface implemented by things that know how to schedule pods onto machines. TODO: Rename this type.

func NewGenericScheduler

func NewGenericScheduler(
	cache internalcache.Cache,
	nodeInfoSnapshot *internalcache.Snapshot,
	extenders []framework.Extender,
	percentageOfNodesToScore int32) ScheduleAlgorithm

NewGenericScheduler creates a genericScheduler object.

type ScheduleResult added in v1.14.0

type ScheduleResult struct {
	// Name of the scheduler suggest host
	SuggestedHost string
	// Number of nodes scheduler evaluated on one pod scheduled
	EvaluatedNodes int
	// Number of feasible nodes on one pod scheduled
	FeasibleNodes int
}

ScheduleResult represents the result of one pod scheduled. It will contain the final selected Node, along with the selected intermediate information.

Jump to

Keyboard shortcuts

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