Skip to content

Commit

Permalink
crash on hash error since it shouldn't ever happen
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 committed Nov 21, 2021
1 parent f3393fc commit cdf0818
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions pkg/controllers/provisioning/binpacking/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,15 @@ func (p *Packer) Pack(ctx context.Context, schedule *scheduling.Schedule, instan
}
key, err := hashstructure.Hash(packing, hashstructure.FormatV2, &hashstructure.HashOptions{SlicesAsSets: true})
if err != nil {
logging.FromContext(ctx).Errorf("Hashing packings to determine node batches")
packings = append(packings, packing)
} else {
if mainPack, ok := packs[key]; ok {
mainPack.NodeQuantity++
mainPack.Pods = append(mainPack.Pods, packing.Pods...)
continue
}
packs[key] = packing
packings = append(packings, packing)
panic("Unable to hash packings while binpacking")
}
if mainPack, ok := packs[key]; ok {
mainPack.NodeQuantity++
mainPack.Pods = append(mainPack.Pods, packing.Pods...)
continue
}
packs[key] = packing
packings = append(packings, packing)
}
for _, pack := range packings {
logging.FromContext(ctx).Infof("Computed packing of %d node(s) for %d pod(s) with instance type option(s) %s", pack.NodeQuantity, flattenedLen(pack.Pods...), instanceTypeNames(pack.InstanceTypeOptions))
Expand Down

0 comments on commit cdf0818

Please sign in to comment.