core

package
v1.5.0-alpha.0....-41f928f Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2017 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoNodeAvailableMsg = "No nodes are available that match all of the predicates"
	// NominatedNodeAnnotationKey is used to annotate a pod that has preempted other pods.
	// The scheduler uses the annotation to find that the pod shouldn't preempt more pods
	// when it gets to the head of scheduling queue again.
	// See podEligibleToPreemptOthers() for more information.
	NominatedNodeAnnotationKey = "NominatedNodeName"
)
View Source
const (
	DefaultExtenderTimeout = 5 * time.Second
)

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.PredicateMetadataProducer,
	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
}

The AlgorithmCache stores PredicateMap with predicate name as key

type EquivalenceCache

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

EquivalenceCache holds: 1. a map of AlgorithmCache with node name as key 2. function to get equivalence pod

func NewEquivalenceCache

func NewEquivalenceCache(getEquivalencePodFunc algorithm.GetEquivalencePodFunc) *EquivalenceCache

func (*EquivalenceCache) InvalidateAllCachedPredicateItemOfNode

func (ec *EquivalenceCache) InvalidateAllCachedPredicateItemOfNode(nodeName string)

InvalidateAllCachedPredicateItemOfNode marks all cached items on given node as invalid

func (*EquivalenceCache) InvalidateCachedPredicateItem

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) InvalidateCachedPredicateItemForPodAdd

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

InvalidateCachedPredicateItemForPodAdd is a wrapper of InvalidateCachedPredicateItem for pod add case

func (*EquivalenceCache) InvalidateCachedPredicateItemOfAllNodes

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

func (ec *EquivalenceCache) PredicateWithECache(
	podName, 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

func (ec *EquivalenceCache) UpdateCachedPredicateItem(
	podName, 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

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) 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
}

HostPredicate is the cached predicate result

type PredicateMap

type PredicateMap map[uint64]HostPredicate

PredicateMap stores HostPrediacte with equivalence hash as key

Jump to

Keyboard shortcuts

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