Skip to content

Commit

Permalink
Fix: backwards compatibility for allocator default settings
Browse files Browse the repository at this point in the history
When the allocator is not defined in the configuration, it will take defaults
and assume there is a "tags" informer. That is not the case. When not defined,
we assume it should allocate only by "freespace".
  • Loading branch information
hsanjuan committed Oct 20, 2021
1 parent 00537ce commit 2905876
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/ipfs-cluster-service/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ func createCluster(
informers = append(informers, tagsinf)
}

// For legacy compatibility we need to make the allocator
// automatically compatible with informers that have been loaded. For
// simplicity we assume that anyone that does not specify an allocator
// configuration (legacy configs), will be using "freespace"
if !cfgMgr.IsLoadedFromJSON(config.Allocator, cfgs.BalancedAlloc.ConfigKey()) {
cfgs.BalancedAlloc.AllocateBy = []string{"freespace"}
}
alloc, err := balanced.New(cfgs.BalancedAlloc)
checkErr("creating allocator", err)

Expand Down

0 comments on commit 2905876

Please sign in to comment.