kubernetes: k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities Index | Files | Directories

package priorities

import "k8s.io/kubernetes/plugin/pkg/scheduler/algorithm/priorities"

Index

Package Files

balanced_resource_allocation.go image_locality.go interpod_affinity.go least_requested.go metadata.go most_requested.go node_affinity.go node_label.go node_prefer_avoid_pods.go selector_spreading.go taint_toleration.go test_util.go

func BalancedResourceAllocationMap Uses

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 fracion 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 Uses

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 CalculateNodeAffinityPriorityReduce Uses

func CalculateNodeAffinityPriorityReduce(pod *v1.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error

func CalculateNodePreferAvoidPodsPriorityMap Uses

func CalculateNodePreferAvoidPodsPriorityMap(pod *v1.Pod, meta interface{}, nodeInfo *schedulercache.NodeInfo) (schedulerapi.HostPriority, error)

func ComputeTaintTolerationPriorityMap Uses

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 ComputeTaintTolerationPriorityReduce Uses

func ComputeTaintTolerationPriorityReduce(pod *v1.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error

ComputeTaintTolerationPriorityReduce calculates the source of each node based on the number of intolerable taints on the node

func ImageLocalityPriorityMap Uses

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 Uses

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 Uses

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 Uses

func NewInterPodAffinityPriority(
    info predicates.NodeInfo,
    nodeLister algorithm.NodeLister,
    podLister algorithm.PodLister,
    hardPodAffinityWeight int) algorithm.PriorityFunction

func NewNodeLabelPriority Uses

func NewNodeLabelPriority(label string, presence bool) (algorithm.PriorityMapFunction, algorithm.PriorityReduceFunction)

func NewSelectorSpreadPriority Uses

func NewSelectorSpreadPriority(
    serviceLister algorithm.ServiceLister,
    controllerLister algorithm.ControllerLister,
    replicaSetLister algorithm.ReplicaSetLister,
    statefulSetLister algorithm.StatefulSetLister) algorithm.PriorityFunction

func NewServiceAntiAffinityPriority Uses

func NewServiceAntiAffinityPriority(podLister algorithm.PodLister, serviceLister algorithm.ServiceLister, label string) algorithm.PriorityFunction

func PriorityMetadata Uses

func PriorityMetadata(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}

PriorityMetadata is a MetadataProducer. Node info can be nil.

type InterPodAffinity Uses

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

func (*InterPodAffinity) CalculateInterPodAffinityPriority Uses

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 Uses

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

func (*NodeLabelPrioritizer) CalculateNodeLabelPriorityMap Uses

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 SelectorSpread Uses

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

func (*SelectorSpread) CalculateSpreadPriority Uses

func (s *SelectorSpread) CalculateSpreadPriority(pod *v1.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo, nodes []*v1.Node) (schedulerapi.HostPriorityList, error)

CalculateSpreadPriority spreads pods across hosts and zones, considering pods belonging to the same service or replication controller. When a pod is scheduled, it looks for services, RCs or RSs 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 or RS selectors as the pod being scheduled. Where zone information is included on the nodes, it favors nodes in zones with fewer existing matching pods.

type ServiceAntiAffinity Uses

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

func (*ServiceAntiAffinity) CalculateAntiAffinityPriority Uses

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

Directories

PathSynopsis
util

Package priorities imports 18 packages (graph) and is imported by 66 packages. Updated 2017-08-23. Refresh now. Tools for package owners.