core

package
v1.13.3-k3s.6 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2019 License: Apache-2.0 Imports: 32 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 EqualPriorityMap

func EqualPriorityMap(_ *v1.Pod, _ interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)

EqualPriorityMap is a prioritizer function that gives an equal weight of one to all nodes

func NewGenericScheduler

func NewGenericScheduler(
	cache schedulerinternalcache.Cache,
	podQueue internalqueue.SchedulingQueue,
	predicates map[string]algorithm.FitPredicate,
	predicateMetaProducer algorithm.PredicateMetadataProducer,
	prioritizers []algorithm.PriorityConfig,
	priorityMetaProducer algorithm.PriorityMetadataProducer,
	extenders []algorithm.SchedulerExtender,
	volumeBinder *volumebinder.VolumeBinder,
	pvcLister corelisters.PersistentVolumeClaimLister,
	pdbLister algorithm.PDBLister,
	alwaysCheckAllPredicates bool,
	disablePreemption bool,
	percentageOfNodesToScore int32,
) algorithm.ScheduleAlgorithm

NewGenericScheduler creates a genericScheduler object.

func NewHTTPExtender

func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerExtender, error)

NewHTTPExtender creates an HTTPExtender object.

func PrioritizeNodes

func PrioritizeNodes(
	pod *v1.Pod,
	nodeNameToInfo map[string]*schedulercache.NodeInfo,
	meta interface{},
	priorityConfigs []algorithm.PriorityConfig,
	nodes []*v1.Node,
	extenders []algorithm.SchedulerExtender,
) (schedulerapi.HostPriorityList, error)

PrioritizeNodes prioritizes the nodes by running the individual priority functions in parallel. Each priority function is expected to set a score of 0-10 0 is the lowest priority score (least preferred node) and 10 is the highest Each priority function can also have its own weight The node scores returned by the priority function are multiplied by the weights to get weighted scores All scores are finally combined (added) to get the total weighted scores of all nodes

Types

type FailedPredicateMap

type FailedPredicateMap map[string][]algorithm.PredicateFailureReason

FailedPredicateMap declares a map[string][]algorithm.PredicateFailureReason type.

type FitError

type FitError struct {
	Pod              *v1.Pod
	NumAllNodes      int
	FailedPredicates FailedPredicateMap
}

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 algorithm.SchedulerExtender 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, nodeNameToInfo map[string]*schedulercache.NodeInfo,
) ([]*v1.Node, schedulerapi.FailedNodesMap, error)

Filter based on extender implemented predicate functions. The filtered list is expected to be a subset of the supplied list. 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

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

func (h *HTTPExtender) Name() string

Name returns extenderURL to identifies the extender.

func (*HTTPExtender) Prioritize

func (h *HTTPExtender) Prioritize(pod *v1.Pod, nodes []*v1.Node) (*schedulerapi.HostPriorityList, int, 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

func (h *HTTPExtender) ProcessPreemption(
	pod *v1.Pod,
	nodeToVictims map[*v1.Node]*schedulerapi.Victims,
	nodeNameToInfo map[string]*schedulercache.NodeInfo,
) (map[*v1.Node]*schedulerapi.Victims, error)

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

func (*HTTPExtender) SupportsPreemption

func (h *HTTPExtender) SupportsPreemption() bool

SupportsPreemption returns if a extender support preemption. A extender should have preempt verb defined and enabled its own node cache.

Jump to

Keyboard shortcuts

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