Skip to content

Commit

Permalink
rename some things
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Sep 1, 2021
1 parent 7815163 commit 03613d2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/controllers/allocation/binpacking/packable.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (p *Packable) Pack(pods []*v1.Pod) *Result {
result.packed = append(result.packed, pod)
continue
}
if p.isFull(pods[len(pods)-1]) {
if p.fits(pods[len(pods)-1]) {
result.unpacked = append(result.unpacked, pods[i:]...)
return result
}
Expand All @@ -109,12 +109,11 @@ func (p *Packable) Pack(pods []*v1.Pod) *Result {
return result
}

// isFull checks if the reserved resources + the minimum resourced pod overflows the total resources available.
func (p *Packable) isFull(minPod *v1.Pod) bool {
minResourceList := resources.RequestsForPods(minPod)
// fits checks if the reserved resources + the pod overflows the total resources available.s
func (p *Packable) fits(pod *v1.Pod) bool {
minResourceList := resources.RequestsForPods(pod)
for resourceName, totalQuantity := range p.total {
reservedQuantity := p.reserved[resourceName].DeepCopy()
// Add the minimum resourced pod to reserved
reservedQuantity.Add(minResourceList[resourceName])
if !totalQuantity.IsZero() && reservedQuantity.Cmp(totalQuantity) >= 0 {
return true
Expand Down

0 comments on commit 03613d2

Please sign in to comment.