Skip to content

Commit

Permalink
Merge pull request #2782 from ncdc/rand-seed
Browse files Browse the repository at this point in the history
🏃 Seed the random number generator
  • Loading branch information
k8s-ci-robot authored Mar 26, 2020
2 parents 8494a2f + 2f296a3 commit 61c12da
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bootstrap/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"flag"
"math/rand"
"net/http"
_ "net/http/pprof"
"os"
Expand Down Expand Up @@ -109,6 +110,8 @@ func InitFlags(fs *pflag.FlagSet) {
}

func main() {
rand.Seed(time.Now().UnixNano())

InitFlags(pflag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
Expand Down
4 changes: 4 additions & 0 deletions cmd/example-provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ package main

import (
"flag"
"math/rand"
"os"
"time"

"k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog"
Expand All @@ -30,6 +32,8 @@ import (
)

func main() {
rand.Seed(time.Now().UnixNano())

klog.InitFlags(nil)
var enableLeaderElection bool
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
Expand Down
3 changes: 3 additions & 0 deletions controlplane/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"flag"
"math/rand"
"net/http"
_ "net/http/pprof"
"os"
Expand Down Expand Up @@ -101,6 +102,8 @@ func InitFlags(fs *pflag.FlagSet) {
"Webhook Server port, disabled by default. When enabled, the manager will only work as webhook server, no reconcilers are installed.")
}
func main() {
rand.Seed(time.Now().UnixNano())

InitFlags(pflag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package main

import (
"flag"
"math/rand"
"net/http"
_ "net/http/pprof"
"os"
Expand Down Expand Up @@ -131,6 +132,8 @@ func InitFlags(fs *pflag.FlagSet) {
}

func main() {
rand.Seed(time.Now().UnixNano())

InitFlags(pflag.CommandLine)
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
pflag.Parse()
Expand Down
3 changes: 3 additions & 0 deletions test/infrastructure/docker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"flag"
"math/rand"
"os"
"time"

Expand Down Expand Up @@ -55,6 +56,8 @@ func init() {
}

func main() {
rand.Seed(time.Now().UnixNano())

klog.InitFlags(nil)
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.IntVar(&concurrency, "concurrency", 10, "The number of docker machines to process simultaneously")
Expand Down

0 comments on commit 61c12da

Please sign in to comment.