File tree 7 files changed +19
-1
lines changed
sdn/plugin/sdn-cni-plugin
7 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,12 @@ package main
3
3
import (
4
4
"flag"
5
5
"fmt"
6
+ "math/rand"
6
7
"net/http"
7
8
_ "net/http/pprof"
8
9
"os"
9
10
"runtime"
11
+ "time"
10
12
11
13
log "github.com/Sirupsen/logrus"
12
14
"k8s.io/kubernetes/pkg/util/logs"
@@ -28,6 +30,7 @@ func main() {
28
30
defer serviceability .Profile (os .Getenv ("OPENSHIFT_PROFILE" )).Stop ()
29
31
startProfiler ()
30
32
33
+ rand .Seed (time .Now ().UTC ().UnixNano ())
31
34
runtime .GOMAXPROCS (runtime .NumCPU ())
32
35
flag .Parse ()
33
36
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "math/rand"
4
5
"os"
5
6
"path/filepath"
6
7
"runtime"
8
+ "time"
7
9
8
10
"k8s.io/kubernetes/pkg/util/logs"
9
11
@@ -22,6 +24,7 @@ func main() {
22
24
defer serviceability .BehaviorOnPanic (os .Getenv ("OPENSHIFT_ON_PANIC" ))()
23
25
defer serviceability .Profile (os .Getenv ("OPENSHIFT_PROFILE" )).Stop ()
24
26
27
+ rand .Seed (time .Now ().UTC ().UnixNano ())
25
28
if len (os .Getenv ("GOMAXPROCS" )) == 0 {
26
29
runtime .GOMAXPROCS (runtime .NumCPU ())
27
30
}
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "math/rand"
4
5
"os"
5
6
"path/filepath"
6
7
"runtime"
8
+ "time"
7
9
8
10
"k8s.io/kubernetes/pkg/util/logs"
9
11
@@ -24,6 +26,7 @@ func main() {
24
26
defer serviceability .BehaviorOnPanic (os .Getenv ("OPENSHIFT_ON_PANIC" ))()
25
27
defer serviceability .Profile (os .Getenv ("OPENSHIFT_PROFILE" )).Stop ()
26
28
29
+ rand .Seed (time .Now ().UTC ().UnixNano ())
27
30
if len (os .Getenv ("GOMAXPROCS" )) == 0 {
28
31
runtime .GOMAXPROCS (runtime .NumCPU ())
29
32
}
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "math/rand"
4
5
"os"
5
6
"path/filepath"
6
7
"runtime"
8
+ "time"
7
9
8
10
"k8s.io/kubernetes/pkg/util/logs"
9
11
@@ -24,6 +26,7 @@ func main() {
24
26
defer serviceability .BehaviorOnPanic (os .Getenv ("OPENSHIFT_ON_PANIC" ))()
25
27
defer serviceability .Profile (os .Getenv ("OPENSHIFT_PROFILE" )).Stop ()
26
28
29
+ rand .Seed (time .Now ().UTC ().UnixNano ())
27
30
if len (os .Getenv ("GOMAXPROCS" )) == 0 {
28
31
runtime .GOMAXPROCS (runtime .NumCPU ())
29
32
}
Original file line number Diff line number Diff line change 8
8
"path"
9
9
"strconv"
10
10
"strings"
11
+ "time"
11
12
12
13
"github.com/golang/glog"
13
14
"github.com/spf13/cobra"
@@ -846,6 +847,7 @@ func generateRoleBindingName(name string) string {
846
847
847
848
// generateStatsPassword creates a random password.
848
849
func generateStatsPassword () string {
850
+ rand := rand .New (rand .NewSource (time .Now ().UTC ().UnixNano ()))
849
851
allowableChars := []rune ("abcdefghijlkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" )
850
852
allowableCharLength := len (allowableChars )
851
853
password := []string {}
Original file line number Diff line number Diff line change @@ -256,7 +256,8 @@ type RandomSerialGenerator struct {
256
256
}
257
257
258
258
func (s * RandomSerialGenerator ) Next (template * x509.Certificate ) (int64 , error ) {
259
- return mathrand .Int63 (), nil
259
+ r := mathrand .New (mathrand .NewSource (time .Now ().UTC ().UnixNano ()))
260
+ return r .Int63 (), nil
260
261
}
261
262
262
263
// EnsureCA returns a CA, whether it was created (as opposed to pre-existing), and any error
Original file line number Diff line number Diff line change @@ -7,10 +7,12 @@ import (
7
7
"encoding/json"
8
8
"fmt"
9
9
"io/ioutil"
10
+ "math/rand"
10
11
"net"
11
12
"net/http"
12
13
"os"
13
14
"strings"
15
+ "time"
14
16
15
17
"github.com/openshift/origin/pkg/sdn/plugin/cniserver"
16
18
@@ -111,6 +113,7 @@ func (p *cniPlugin) CmdDel(args *skel.CmdArgs) error {
111
113
}
112
114
113
115
func main () {
116
+ rand .Seed (time .Now ().UTC ().UnixNano ())
114
117
p := NewCNIPlugin (cniserver .CNIServerSocketPath )
115
118
skel .PluginMain (p .skelCmdAdd , p .CmdDel , version .Legacy )
116
119
}
You can’t perform that action at this time.
0 commit comments