Merge pull request #69670 from atlassian/simplify-rand-seed

Simplify rand seeding
This commit is contained in:
k8s-ci-robot
2018-10-15 13:53:01 -07:00
committed by GitHub
22 changed files with 28 additions and 22 deletions

View File

@@ -99,7 +99,7 @@ func NewKubemarkController(externalClient kubeclient.Interface, externalInformer
nodesToDelete: make(map[string]bool),
nodesToDeleteLock: sync.Mutex{},
},
rand: rand.New(rand.NewSource(time.Now().UTC().UnixNano())),
rand: rand.New(rand.NewSource(time.Now().UnixNano())),
createNodeQueue: make(chan string, 1000),
nodeGroupQueueSize: make(map[string]int),
nodeGroupQueueSizeLock: sync.Mutex{},

View File

@@ -18,7 +18,6 @@ package flocker
import (
"fmt"
"time"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/rand"
@@ -68,7 +67,6 @@ func (util *flockerUtil) CreateVolume(c *flockerVolumeProvisioner) (datasetUUID
}
// select random node
rand.Seed(time.Now().UTC().UnixNano())
node := nodes[rand.Intn(len(nodes))]
glog.V(2).Infof("selected flocker node with UUID '%s' to provision dataset", node.UUID)