Skip to content

Commit

Permalink
balloons: fix the order of assigning containers into balloons
Browse files Browse the repository at this point in the history
Assign containers into balloons in the order in which their pods and
themselves have been created. This makes policy restart and
reconfiguration behavior more predictable.

Signed-off-by: Antti Kervinen <[email protected]>
  • Loading branch information
askervin committed Mar 1, 2024
1 parent f285001 commit ad41e5e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/plugins/balloons/policy/balloons-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ func (p *balloons) Sync(add []cache.Container, del []cache.Container) error {
log.Warnf("releasing resources for Sync produced an error: %v", err)
}
}

cache.SortContainers(add, cache.ComparePodCtime, cache.CompareContainerCtime)

for _, c := range add {
if err := p.AllocateResources(c); err != nil {
log.Warnf("allocating resources for Sync produced an error: %v", err)
Expand Down

0 comments on commit ad41e5e

Please sign in to comment.