mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Simplify random seed initialization
There is no need to set the time zone as the result does not depend on it
This commit is contained in:
parent
effd009dab
commit
3a243090a5
@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewCloudControllerManagerCommand()
|
||||
|
||||
|
@ -47,7 +47,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
hyperkubeCommand, allCommandFns := NewHyperKubeCommand(server.SetupSignalHandler())
|
||||
|
||||
|
@ -36,7 +36,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewAPIServerCommand(server.SetupSignalHandler())
|
||||
|
||||
|
@ -39,7 +39,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewControllerManagerCommand()
|
||||
|
||||
|
@ -33,7 +33,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewProxyCommand()
|
||||
|
||||
|
@ -32,7 +32,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewSchedulerCommand()
|
||||
|
||||
|
@ -34,7 +34,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := cmd.NewDefaultKubectlCommand()
|
||||
|
||||
|
@ -732,7 +732,7 @@ func run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, stopCh <-chan
|
||||
|
||||
utilruntime.ReallyCrash = s.ReallyCrashForTesting
|
||||
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
// TODO(vmarmol): Do this through container config.
|
||||
oomAdjuster := kubeDeps.OOMAdjuster
|
||||
|
@ -34,7 +34,7 @@ import (
|
||||
)
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := app.NewKubeletCommand(server.SetupSignalHandler())
|
||||
logs.InitLogs()
|
||||
|
@ -100,7 +100,7 @@ func (c *HollowNodeConfig) createClientConfigFromFile() (*restclient.Config, err
|
||||
}
|
||||
|
||||
func main() {
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
command := newHollowNodeCommand()
|
||||
|
||||
|
@ -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{},
|
||||
|
@ -68,7 +68,7 @@ func (util *FlockerUtil) CreateVolume(c *flockerVolumeProvisioner) (datasetUUID
|
||||
}
|
||||
|
||||
// select random node
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
node := nodes[rand.Intn(len(nodes))]
|
||||
glog.V(2).Infof("selected flocker node with UUID '%s' to provision dataset", node.UUID)
|
||||
|
||||
|
@ -27,7 +27,7 @@ var rng = struct {
|
||||
sync.Mutex
|
||||
rand *rand.Rand
|
||||
}{
|
||||
rand: rand.New(rand.NewSource(time.Now().UTC().UnixNano())),
|
||||
rand: rand.New(rand.NewSource(time.Now().UnixNano())),
|
||||
}
|
||||
|
||||
// Intn generates an integer in range [0,max).
|
||||
|
@ -1111,7 +1111,7 @@ var _ = SIGDescribe("Services", func() {
|
||||
}
|
||||
|
||||
outOfRangeNodePort := 0
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
for {
|
||||
outOfRangeNodePort = 1 + rand.Intn(65535)
|
||||
if !framework.ServiceNodePortRange.Contains(outOfRangeNodePort) {
|
||||
|
@ -79,7 +79,7 @@ var _ = utils.SIGDescribe("Pod Disks", func() {
|
||||
host0Name = types.NodeName(nodes.Items[0].ObjectMeta.Name)
|
||||
host1Name = types.NodeName(nodes.Items[1].ObjectMeta.Name)
|
||||
|
||||
mathrand.Seed(time.Now().UTC().UnixNano())
|
||||
mathrand.Seed(time.Now().UnixNano())
|
||||
})
|
||||
|
||||
Context("schedule pods each with a PD, delete pod and verify detach [Slow]", func() {
|
||||
|
@ -119,7 +119,7 @@ func TestE2eNode(t *testing.T) {
|
||||
return
|
||||
}
|
||||
// If run-services-mode is not specified, run test.
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
RegisterFailHandler(Fail)
|
||||
reporters := []Reporter{}
|
||||
reportDir := framework.TestContext.ReportDir
|
||||
|
@ -188,7 +188,7 @@ func main() {
|
||||
glog.Fatalf("--test-suite must be one of default or conformance")
|
||||
}
|
||||
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
if *buildOnly {
|
||||
// Build the archive and exit
|
||||
remote.CreateTestArchive(suite, *systemSpecName)
|
||||
|
Loading…
Reference in New Issue
Block a user