package helper
import "k8s.io/kubernetes/pkg/scheduler/framework/plugins/helper"
Index ¶
- func BuildBrokenLinearFunction(shape FunctionShape) func(int64) int64
- func DefaultNormalizeScore(maxPriority int64, reverse bool, scores framework.NodeScoreList) *framework.Status
- func DefaultSelector(pod *v1.Pod, sl corelisters.ServiceLister, cl corelisters.ReplicationControllerLister, rsl appslisters.ReplicaSetLister, ssl appslisters.StatefulSetLister) labels.Selector
- func GetPodServices(sl corelisters.ServiceLister, pod *v1.Pod) ([]*v1.Service, error)
- func NodeMatchesNodeAffinity(affinity *v1.NodeAffinity, node *v1.Node) bool
- func PodMatchesNodeSelectorAndAffinityTerms(pod *v1.Pod, node *v1.Node) bool
- type FunctionShape
- type FunctionShapePoint
Functions ¶
func BuildBrokenLinearFunction ¶
func BuildBrokenLinearFunction(shape FunctionShape) func(int64) int64
BuildBrokenLinearFunction creates a function which is built using linear segments. Segments are defined via shape array. Shape[i].Utilization slice represents points on "Utilization" axis where different segments meet. Shape[i].Score represents function values at meeting points.
function f(p) is defined as:
shape[0].Score for p < f[0].Utilization shape[i].Score for p == shape[i].Utilization shape[n-1].Score for p > shape[n-1].Utilization
and linear between points (p < shape[i].Utilization)
func DefaultNormalizeScore ¶
func DefaultNormalizeScore(maxPriority int64, reverse bool, scores framework.NodeScoreList) *framework.Status
DefaultNormalizeScore generates a Normalize Score function that can normalize the scores to [0, maxPriority]. If reverse is set to true, it reverses the scores by subtracting it from maxPriority.
func DefaultSelector ¶
func DefaultSelector(pod *v1.Pod, sl corelisters.ServiceLister, cl corelisters.ReplicationControllerLister, rsl appslisters.ReplicaSetLister, ssl appslisters.StatefulSetLister) labels.Selector
DefaultSelector returns a selector deduced from the Services, Replication Controllers, Replica Sets, and Stateful Sets matching the given pod.
func GetPodServices ¶
func GetPodServices(sl corelisters.ServiceLister, pod *v1.Pod) ([]*v1.Service, error)
GetPodServices gets the services that have the selector that match the labels on the given pod.
func NodeMatchesNodeAffinity ¶
func NodeMatchesNodeAffinity(affinity *v1.NodeAffinity, node *v1.Node) bool
NodeMatchesNodeAffinity checks whether the Node satisfy the given NodeAffinity.
func PodMatchesNodeSelectorAndAffinityTerms ¶
PodMatchesNodeSelectorAndAffinityTerms checks whether the pod is schedulable onto nodes according to the requirements in both NodeAffinity and nodeSelector.
Types ¶
type FunctionShape ¶
type FunctionShape []FunctionShapePoint
FunctionShape represents a collection of FunctionShapePoint.
type FunctionShapePoint ¶
type FunctionShapePoint struct { // Utilization is function argument. Utilization int64 // Score is function value. Score int64 }
FunctionShapePoint represents a shape point.
Source Files ¶
node_affinity.go normalize_score.go shape_score.go spread.go
- Version
- v1.21.0
- Published
- Apr 8, 2021
- Platform
- js/wasm
- Imports
- 7 packages
- Last checked
- 36 seconds ago –
Tools for package owners.