Skip to content

Commit

Permalink
Only add fallbackstrategy if nonempty
Browse files Browse the repository at this point in the history
  • Loading branch information
lhp-nemlig committed Nov 22, 2024
1 parent 7d32f7e commit 0254654
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/otel-allocator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,13 @@ func main() {
log := ctrl.Log.WithName("allocator")

allocatorPrehook = prehook.New(cfg.FilterStrategy, log)
allocator, err = allocation.New(cfg.AllocationStrategy, log, allocation.WithFilter(allocatorPrehook), allocation.WithFallbackStrategy(cfg.AllocationFallbackStrategy))

var allocationOptions []allocation.AllocationOption
allocationOptions = append(allocationOptions, allocation.WithFilter(allocatorPrehook))
if cfg.AllocationFallbackStrategy != "" {
allocationOptions = append(allocationOptions, allocation.WithFallbackStrategy(cfg.AllocationFallbackStrategy))
}
allocator, err = allocation.New(cfg.AllocationStrategy, log, allocationOptions...)
if err != nil {
setupLog.Error(err, "Unable to initialize allocation strategy")
os.Exit(1)
Expand Down

0 comments on commit 0254654

Please sign in to comment.