Merge pull request https://github.com/kubernetes/contrib/pull/1670 from mwielgus/random-node-pool
Cluster-autoscaler: pick one of the matching node groups at random
This commit is contained in:
commit
cb9ceffe41
|
|
@ -18,6 +18,7 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
|
|
@ -181,7 +182,8 @@ func GetNodeInfosForGroups(nodes []*kube_api.Node, cloudProvider cloudprovider.C
|
|||
// BestExpansionOption picks the best cluster expansion option.
|
||||
func BestExpansionOption(expansionOptions []ExpansionOption) *ExpansionOption {
|
||||
if len(expansionOptions) > 0 {
|
||||
return &expansionOptions[0]
|
||||
pos := rand.Int31n(int32(len(expansionOptions)))
|
||||
return &expansionOptions[pos]
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue