Documentation
¶
Index ¶
- Variables
- func BalancedResourceAllocationMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func CalculateNodeAffinityPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func CalculateNodePreferAvoidPodsPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func ComputeTaintTolerationPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func ImageLocalityPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func LeastRequestedPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func MostRequestedPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- func NewInterPodAffinityPriority(info predicates.NodeInfo, nodeLister algorithm.NodeLister, ...) algorithm.PriorityFunction
- func NewNodeLabelPriority(label string, presence bool) (algorithm.PriorityMapFunction, algorithm.PriorityReduceFunction)
- func NewPriorityMetadataFactory(serviceLister algorithm.ServiceLister, ...) algorithm.MetadataProducer
- func NewSelectorSpreadPriority(serviceLister algorithm.ServiceLister, ...) (algorithm.PriorityMapFunction, algorithm.PriorityReduceFunction)
- func NewServiceAntiAffinityPriority(podLister algorithm.PodLister, serviceLister algorithm.ServiceLister, ...) algorithm.PriorityFunction
- func NormalizeReduce(maxPriority int, reverse bool) algorithm.PriorityReduceFunction
- func ResourceLimitsPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
- type InterPodAffinity
- type NodeLabelPrioritizer
- type PriorityMetadataFactory
- type SelectorSpread
- type ServiceAntiAffinity
Constants ¶
This section is empty.
Variables ¶
var CalculateNodeAffinityPriorityReduce = NormalizeReduce(schedulerapi.MaxPriority, false)
var ComputeTaintTolerationPriorityReduce = NormalizeReduce(schedulerapi.MaxPriority, true)
ComputeTaintTolerationPriorityReduce calculates the source of each node based on the number of intolerable taints on the node
Functions ¶
func BalancedResourceAllocationMap ¶ added in v1.7.0
func BalancedResourceAllocationMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
BalancedResourceAllocationMap favors nodes with balanced resource usage rate. BalancedResourceAllocationMap should **NOT** be used alone, and **MUST** be used together with LeastRequestedPriority. It calculates the difference between the cpu and memory fraction of capacity, and prioritizes the host based on how close the two metrics are to each other. Detail: score = 10 - abs(cpuFraction-memoryFraction)*10. The algorithm is partly inspired by: "Wei Huang et al. An Energy Efficient Virtual Machine Placement Algorithm with Balanced Resource Utilization"
func CalculateNodeAffinityPriorityMap ¶ added in v1.7.0
func CalculateNodeAffinityPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
CalculateNodeAffinityPriority prioritizes nodes according to node affinity scheduling preferences indicated in PreferredDuringSchedulingIgnoredDuringExecution. Each time a node match a preferredSchedulingTerm, it will a get an add of preferredSchedulingTerm.Weight. Thus, the more preferredSchedulingTerms the node satisfies and the more the preferredSchedulingTerm that is satisfied weights, the higher score the node gets.
func CalculateNodePreferAvoidPodsPriorityMap ¶ added in v1.7.0
func CalculateNodePreferAvoidPodsPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
func ComputeTaintTolerationPriorityMap ¶ added in v1.7.0
func ComputeTaintTolerationPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
ComputeTaintTolerationPriorityMap prepares the priority list for all the nodes based on the number of intolerable taints on the node
func ImageLocalityPriorityMap ¶ added in v1.7.0
func ImageLocalityPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
ImageLocalityPriorityMap is a priority function that favors nodes that already have requested pod container's images. It will detect whether the requested images are present on a node, and then calculate a score ranging from 0 to 10 based on the total size of those images. - If none of the images are present, this node will be given the lowest priority. - If some of the images are present on a node, the larger their sizes' sum, the higher the node's priority.
func LeastRequestedPriorityMap ¶ added in v1.7.0
func LeastRequestedPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
LeastRequestedPriority is a priority function that favors nodes with fewer requested resources. It calculates the percentage of memory and CPU requested by pods scheduled on the node, and prioritizes based on the minimum of the average of the fraction of requested to capacity. Details: cpu((capacity - sum(requested)) * 10 / capacity) + memory((capacity - sum(requested)) * 10 / capacity) / 2
func MostRequestedPriorityMap ¶ added in v1.7.0
func MostRequestedPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
MostRequestedPriority is a priority function that favors nodes with most requested resources. It calculates the percentage of memory and CPU requested by pods scheduled on the node, and prioritizes based on the maximum of the average of the fraction of requested to capacity. Details: (cpu(10 * sum(requested) / capacity) + memory(10 * sum(requested) / capacity)) / 2
func NewInterPodAffinityPriority ¶ added in v1.3.0
func NewInterPodAffinityPriority( info predicates.NodeInfo, nodeLister algorithm.NodeLister, podLister algorithm.PodLister, hardPodAffinityWeight int32) algorithm.PriorityFunction
func NewNodeLabelPriority ¶
func NewNodeLabelPriority(label string, presence bool) (algorithm.PriorityMapFunction, algorithm.PriorityReduceFunction)
func NewPriorityMetadataFactory ¶ added in v1.9.0
func NewPriorityMetadataFactory(serviceLister algorithm.ServiceLister, controllerLister algorithm.ControllerLister, replicaSetLister algorithm.ReplicaSetLister, statefulSetLister algorithm.StatefulSetLister) algorithm.MetadataProducer
func NewSelectorSpreadPriority ¶ added in v1.3.0
func NewSelectorSpreadPriority( serviceLister algorithm.ServiceLister, controllerLister algorithm.ControllerLister, replicaSetLister algorithm.ReplicaSetLister, statefulSetLister algorithm.StatefulSetLister) (algorithm.PriorityMapFunction, algorithm.PriorityReduceFunction)
func NewServiceAntiAffinityPriority ¶
func NewServiceAntiAffinityPriority(podLister algorithm.PodLister, serviceLister algorithm.ServiceLister, label string) algorithm.PriorityFunction
func NormalizeReduce ¶ added in v1.9.0
func NormalizeReduce(maxPriority int, reverse bool) algorithm.PriorityReduceFunction
NormalizeReduce generates a PriorityReduceFunction that can normalize the result scores to [0, maxPriority]. If reverse is set to true, it reverses the scores by subtracting it from maxPriority.
func ResourceLimitsPriorityMap ¶ added in v1.9.0
func ResourceLimitsPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
ResourceLimitsPriorityMap is a priority function that increases score of input node by 1 if the node satisfies input pod's resource limits. In detail, this priority function works as follows: If a node does not publish its allocatable resources (cpu and memory both), the node score is not affected. If a pod does not specify its cpu and memory limits both, the node score is not affected. If one or both of cpu and memory limits of the pod are satisfied, the node is assigned a score of 1. Rationale of choosing the lowest score of 1 is that this is mainly selected to break ties between nodes that have same scores assigned by one of least and most requested priority functions.
Types ¶
type InterPodAffinity ¶ added in v1.3.0
type InterPodAffinity struct {
// contains filtered or unexported fields
}
func (*InterPodAffinity) CalculateInterPodAffinityPriority ¶ added in v1.3.0
func (ipa *InterPodAffinity) CalculateInterPodAffinityPriority(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error)
CalculateInterPodAffinityPriority compute a sum by iterating through the elements of weightedPodAffinityTerm and adding "weight" to the sum if the corresponding PodAffinityTerm is satisfied for that node; the node(s) with the highest sum are the most preferred. Symmetry need to be considered for preferredDuringSchedulingIgnoredDuringExecution from podAffinity & podAntiAffinity, symmetry need to be considered for hard requirements from podAffinity
type NodeLabelPrioritizer ¶
type NodeLabelPrioritizer struct {
// contains filtered or unexported fields
}
func (*NodeLabelPrioritizer) CalculateNodeLabelPriorityMap ¶ added in v1.7.0
func (n *NodeLabelPrioritizer) CalculateNodeLabelPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
CalculateNodeLabelPriority checks whether a particular label exists on a node or not, regardless of its value. If presence is true, prioritizes nodes that have the specified label, regardless of value. If presence is false, prioritizes nodes that do not have the specified label.
type PriorityMetadataFactory ¶ added in v1.9.0
type PriorityMetadataFactory struct {
// contains filtered or unexported fields
}
func (*PriorityMetadataFactory) PriorityMetadata ¶ added in v1.9.0
func (pmf *PriorityMetadataFactory) PriorityMetadata(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}
PriorityMetadata is a MetadataProducer. Node info can be nil.
type SelectorSpread ¶ added in v1.3.0
type SelectorSpread struct {
// contains filtered or unexported fields
}
func (*SelectorSpread) CalculateSpreadPriorityMap ¶ added in v1.9.0
func (s *SelectorSpread) CalculateSpreadPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)
CalculateSpreadPriorityMap spreads pods across hosts, considering pods belonging to the same service,RC,RS or StatefulSet. When a pod is scheduled, it looks for services, RCs,RSs and StatefulSets that match the pod, then finds existing pods that match those selectors. It favors nodes that have fewer existing matching pods. i.e. it pushes the scheduler towards a node where there's the smallest number of pods which match the same service, RC,RSs or StatefulSets selectors as the pod being scheduled.
func (*SelectorSpread) CalculateSpreadPriorityReduce ¶ added in v1.9.0
func (s *SelectorSpread) CalculateSpreadPriorityReduce(pod *v1.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error
CalculateSpreadPriorityReduce calculates the source of each node based on the number of existing matching pods on the node where zone information is included on the nodes, it favors nodes in zones with fewer existing matching pods.
type ServiceAntiAffinity ¶
type ServiceAntiAffinity struct {
// contains filtered or unexported fields
}
func (*ServiceAntiAffinity) CalculateAntiAffinityPriority ¶
func (s *ServiceAntiAffinity) CalculateAntiAffinityPriority(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error)
CalculateAntiAffinityPriority spreads pods by minimizing the number of pods belonging to the same service on machines with the same value for a particular label. The label to be considered is provided to the struct (ServiceAntiAffinity).