Documentation ¶
Index ¶
- Constants
- Variables
- func EqualPriorityMap(_ *v1.Pod, _ interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func NewGenericScheduler(cache schedulercache.Cache, eCache *EquivalenceCache, ...) algorithm.ScheduleAlgorithm
- func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerExtender, error)
- func PrioritizeNodes(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, ...) (schedulerapi.HostPriorityList, error)
- type AlgorithmCache
- type EquivalenceCache
- func (ec *EquivalenceCache) InvalidateAllCachedPredicateItemOfNode(nodeName string)
- func (ec *EquivalenceCache) InvalidateCachedPredicateItem(nodeName string, predicateKeys sets.String)
- func (ec *EquivalenceCache) InvalidateCachedPredicateItemForPodAdd(pod *v1.Pod, nodeName string)
- func (ec *EquivalenceCache) InvalidateCachedPredicateItemOfAllNodes(predicateKeys sets.String)
- func (ec *EquivalenceCache) PredicateWithECache(podName, nodeName, predicateKey string, equivalenceHash uint64) (bool, []algorithm.PredicateFailureReason, bool)
- func (ec *EquivalenceCache) UpdateCachedPredicateItem(podName, nodeName, predicateKey string, fit bool, ...)
- type FIFO
- type FailedPredicateMap
- type FitError
- type HTTPExtender
- func (h *HTTPExtender) Bind(binding *v1.Binding) error
- func (h *HTTPExtender) Filter(pod *v1.Pod, nodes []*v1.Node, ...) ([]*v1.Node, schedulerapi.FailedNodesMap, error)
- func (h *HTTPExtender) IsBinder() bool
- func (h *HTTPExtender) Prioritize(pod *v1.Pod, nodes []*v1.Node) (*schedulerapi.HostPriorityList, int, error)
- type HostPredicate
- type PredicateMap
- type SchedulingQueue
Constants ¶
const ( NoNodeAvailableMsg = "0/%v nodes are available" // 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" )
const (
DefaultExtenderTimeout = 5 * time.Second
)
Variables ¶
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 NewHTTPExtender ¶
func NewHTTPExtender(config *schedulerapi.ExtenderConfig) (algorithm.SchedulerExtender, error)
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 ¶
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 ¶ 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) 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( 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 ¶ added in v1.7.0
func (ec *EquivalenceCache) UpdateCachedPredicateItem( podName, nodeName, predicateKey string, fit bool, reasons []algorithm.PredicateFailureReason, equivalenceHash uint64, )
UpdateCachedPredicateItem updates pod predicate for equivalence class
type FIFO ¶ added in v1.9.0
FIFO is only used to add a Pop() method to cache.FIFO so that it can be used as a SchedulingQueue interface.
func (*FIFO) Pop ¶ added in v1.9.0
Pop removes the head of FIFO and returns it. This is just a copy/paste of cache.Pop(queue Queue) from fifo.go that scheduler has always been using. There is a comment in that file saying that this method shouldn't be used in production code, but scheduler has always been using it. This function does minimal error checking.
type FailedPredicateMap ¶
type FailedPredicateMap map[string][]algorithm.PredicateFailureReason
type FitError ¶
type FitError struct { Pod *v1.Pod NumAllNodes int FailedPredicates FailedPredicateMap }
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 }
HostPredicate is the cached predicate result
type PredicateMap ¶ added in v1.7.0
type PredicateMap map[uint64]HostPredicate
PredicateMap stores HostPrediacte with equivalence hash as key
type SchedulingQueue ¶ added in v1.9.0
type SchedulingQueue interface { Add(obj interface{}) error AddIfNotPresent(obj interface{}) error Pop() (interface{}, error) Update(obj interface{}) error Delete(obj interface{}) error List() []interface{} ListKeys() []string Get(obj interface{}) (item interface{}, exists bool, err error) GetByKey(key string) (item interface{}, exists bool, err error) }
SchedulingQueue is an interface for a queue to store pods waiting to be scheduled. The interface follows a pattern similar to cache.FIFO and cache.Heap and makes it easy to use those data structures as a SchedulingQueue.