Documentation
¶
Index ¶
- func GetNodeScoreSelector(scoringStrategy commontypes.NodeScoringStrategy) (service.NodeScoreSelector, error)
- func GetNodeScorer(scoringStrategy commontypes.NodeScoringStrategy, ...) (service.NodeScorer, error)
- func SelectMaxAllocatable(nodeScores []service.NodeScore, weightsFn service.GetWeightsFunc, ...) (winner *service.NodeScore, err error)
- func SelectMinPrice(nodeScores []service.NodeScore, weightsFn service.GetWeightsFunc, ...) (winner *service.NodeScore, err error)
- type LeastCost
- type LeastWaste
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNodeScoreSelector ¶
func GetNodeScoreSelector(scoringStrategy commontypes.NodeScoringStrategy) (service.NodeScoreSelector, error)
GetNodeScoreSelector returns the NodeScoreSelector based on the scoring strategy
func GetNodeScorer ¶
func GetNodeScorer(scoringStrategy commontypes.NodeScoringStrategy, instancePricingAccess service.InstancePricingAccess, weightsFn service.GetWeightsFunc) (service.NodeScorer, error)
func SelectMaxAllocatable ¶
func SelectMaxAllocatable(nodeScores []service.NodeScore, weightsFn service.GetWeightsFunc, pricing service.InstancePricingAccess) (winner *service.NodeScore, err error)
SelectMaxAllocatable returns the index of the node score for the node with the highest allocatable resources. This has been done to bias the scorer to pick larger instance types when all other parameters are the same. Larger instance types --> less fragmentation if multiple node scores have instance types with the same allocatable, an index is picked at random from them
func SelectMinPrice ¶
func SelectMinPrice(nodeScores []service.NodeScore, weightsFn service.GetWeightsFunc, pricing service.InstancePricingAccess) (winner *service.NodeScore, err error)
SelectMinPrice returns the index of the node score for the node with the lowest price. if multiple node scores have instance types with the same price, an index is picked at random from them
Types ¶
type LeastCost ¶
type LeastCost struct {
// contains filtered or unexported fields
}
func (LeastCost) Compute ¶
Compute uses the least-cost strategy to generate a score representing the number of resource units scheduled per unit cost. Here, resource unit is an abstraction used to represent and operate upon multiple heterogeneous resource requests. Resource quantities of different resource types are reduced to a representation in terms of resource units based on pre-configured weights.
type LeastWaste ¶
type LeastWaste struct {
// contains filtered or unexported fields
}
func (LeastWaste) Compute ¶
func (l LeastWaste) Compute(args service.NodeScorerArgs) (nodeScore service.NodeScore, err error)
Compute returns the NodeScore for the least-waste strategy. Instead of calculating absolute wastage across the cluster, we look at delta wastage as a score. Delta wastage can be calculated by summing the wastage on the scaled candidate node and the "negative" waste created as a result of unscheduled pods being scheduled on to existing nodes. Existing nodes include simulated winner nodes from previous runs. Waste = Alloc(ScaledNode) - TotalResourceRequests(Pods scheduled due to scale up) Example: SN* - simulated node N* - existing node Case 1: pods assigned to scaled node only SN1: 4GB allocatable Pod A : 1 GB --> SN1 Pod B: 2 GB --> SN1 Pod C: 1 GB --> SN1
Waste = 4-(1+2+1) = 0
Case 2: pods assigned to existing nodes also SN2: 4GB N2: 8GB avail N3: 4GB avail Pod A : 1 GB --> SN1 Pod B: 2 GB --> N2 Pod C: 3 GB --> N3
Waste = 4 - (1+2+3) = -2