Move RequestedToCapacityRatio argument processing to its plugin

This commit is contained in:
Abdullah Gharaibeh
2020-01-06 11:46:35 -05:00
parent 405714b262
commit b9e2389e0d
10 changed files with 114 additions and 181 deletions

View File

@@ -67,14 +67,14 @@ func NewMostAllocated(_ *runtime.Unknown, h framework.FrameworkHandle) (framewor
resourceAllocationScorer: resourceAllocationScorer{
MostAllocatedName,
mostResourceScorer,
DefaultRequestedRatioResources,
defaultRequestedRatioResources,
},
}, nil
}
func mostResourceScorer(requested, allocable resourceToValueMap, includeVolumes bool, requestedVolumes int, allocatableVolumes int) int64 {
var nodeScore, weightSum int64
for resource, weight := range DefaultRequestedRatioResources {
for resource, weight := range defaultRequestedRatioResources {
resourceScore := mostRequestedScore(requested[resource], allocable[resource])
nodeScore += resourceScore * weight
weightSum += weight