core

package
v1.7.15-beta.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultExtenderTimeout = 5 * time.Second
)
View Source
const NoNodeAvailableMsg = "No nodes are available that match all of the following predicates:"

Variables

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

Functions

func EqualPriorityMap

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

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

func NewGenericScheduler

func NewGenericScheduler(
	cache schedulercache.Cache,
	eCache *EquivalenceCache,
	predicates map[string]algorithm.FitPredicate,
	predicateMetaProducer algorithm.MetadataProducer,
	prioritizers []algorithm.PriorityConfig,
	priorityMetaProducer algorithm.MetadataProducer,
	extenders []algorithm.SchedulerExtender) algorithm.ScheduleAlgorithm

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)

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 AlgorithmCache

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

type EquivalenceCache

type EquivalenceCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Store a map of predicate cache with maxsize

func NewEquivalenceCache

func NewEquivalenceCache(getEquivalencePodFunc algorithm.GetEquivalencePodFunc) *EquivalenceCache

func (*EquivalenceCache) InvalidateAllCachedPredicateItemOfNode added in v1.7.0

func (ec *EquivalenceCache) InvalidateAllCachedPredicateItemOfNode(nodeName string)

InvalidateAllCachedPredicateItemOfNode marks all cached items on given node as invalid

func (*EquivalenceCache) InvalidateCachedPredicateItem added in v1.7.0

func (ec *EquivalenceCache) InvalidateCachedPredicateItem(nodeName string, predicateKeys sets.String)

InvalidateCachedPredicateItem marks all items of given predicateKeys, of all pods, on the given node as invalid

func (*EquivalenceCache) InvalidateCachedPredicateItemForPod added in v1.7.0

func (ec *EquivalenceCache) InvalidateCachedPredicateItemForPod(nodeName string, predicateKeys sets.String, pod *v1.Pod)

InvalidateCachedPredicateItemForPod marks item of given predicateKeys, of given pod, on the given node as invalid

func (*EquivalenceCache) InvalidateCachedPredicateItemForPodAdd added in v1.7.0

func (ec *EquivalenceCache) InvalidateCachedPredicateItemForPodAdd(pod *v1.Pod, nodeName string)

InvalidateCachedPredicateItemForPodAdd is a wrapper of InvalidateCachedPredicateItem for pod add case

func (*EquivalenceCache) InvalidateCachedPredicateItemOfAllNodes added in v1.7.0

func (ec *EquivalenceCache) InvalidateCachedPredicateItemOfAllNodes(predicateKeys sets.String)

InvalidateCachedPredicateItemOfAllNodes marks all items of given predicateKeys, of all pods, on all node as invalid

func (*EquivalenceCache) PredicateWithECache added in v1.7.0

func (ec *EquivalenceCache) PredicateWithECache(pod *v1.Pod, nodeName, predicateKey string, equivalenceHash uint64) (bool, []algorithm.PredicateFailureReason, bool)

PredicateWithECache returns: 1. if fit 2. reasons if not fit 3. if this cache is invalid based on cached predicate results

func (*EquivalenceCache) UpdateCachedPredicateItem added in v1.7.0

func (ec *EquivalenceCache) UpdateCachedPredicateItem(pod *v1.Pod, nodeName, predicateKey string, fit bool, reasons []algorithm.PredicateFailureReason, equivalenceHash uint64)

UpdateCachedPredicateItem updates pod predicate for equivalence class

type FailedPredicateMap

type FailedPredicateMap map[string][]algorithm.PredicateFailureReason

type FitError

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

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

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

func (h *HTTPExtender) IsBinder() bool

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

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.

type HostPredicate

type HostPredicate struct {
	Fit         bool
	FailReasons []algorithm.PredicateFailureReason
}

type PredicateMap added in v1.7.0

type PredicateMap map[uint64]HostPredicate

PredicateMap use equivalence hash as key

Jump to

Keyboard shortcuts

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