From 66e0b53c3cdb8255b2d6abbe37caa91486a930e5 Mon Sep 17 00:00:00 2001 From: xiechengsheng Date: Fri, 22 Jun 2018 09:26:14 +0800 Subject: [PATCH] fix some typos Signed-off-by: xiechengsheng --- .../priorities/balanced_resource_allocation.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/scheduler/algorithm/priorities/balanced_resource_allocation.go b/pkg/scheduler/algorithm/priorities/balanced_resource_allocation.go index 85971d316a9..c77dd399d5a 100644 --- a/pkg/scheduler/algorithm/priorities/balanced_resource_allocation.go +++ b/pkg/scheduler/algorithm/priorities/balanced_resource_allocation.go @@ -44,8 +44,8 @@ func balancedResourceScorer(requested, allocable *schedulercache.Resource, inclu // This to find a node which has most balanced CPU, memory and volume usage. if includeVolumes && utilfeature.DefaultFeatureGate.Enabled(features.BalanceAttachedNodeVolumes) && allocatableVolumes > 0 { volumeFraction := float64(requestedVolumes) / float64(allocatableVolumes) - if cpuFraction > 1 || memoryFraction > 1 || volumeFraction > 1 { - // if requested > capacity, the corresponding host should never be preferred. + if cpuFraction >= 1 || memoryFraction >= 1 || volumeFraction >= 1 { + // if requested >= capacity, the corresponding host should never be preferred. return 0 } // Compute variance for all the three fractions. @@ -57,8 +57,8 @@ func balancedResourceScorer(requested, allocable *schedulercache.Resource, inclu return int64((1 - variance) * float64(schedulerapi.MaxPriority)) } - if cpuFraction > 1 || memoryFraction > 1 { - // if requested > capacity, the corresponding host should never be preferred. + if cpuFraction >= 1 || memoryFraction >= 1 { + // if requested >= capacity, the corresponding host should never be preferred. return 0 } // Upper and lower boundary of difference between cpuFraction and memoryFraction are -1 and 1 @@ -71,7 +71,7 @@ func balancedResourceScorer(requested, allocable *schedulercache.Resource, inclu func fractionOfCapacity(requested, capacity int64) float64 { if capacity == 0 { - return math.MaxFloat64 + return 1 } return float64(requested) / float64(capacity) }