Skip to content

Commit

Permalink
Kubectl ko diagnose perf (#2915)
Browse files Browse the repository at this point in the history
* 1. add kubectl ko perf
2. kube-ovn-pinger add tcp/udp test

* 1. refactor perf test
    2. add kubectl ko diagnose subnet

* remove test pod
  • Loading branch information
changluyi committed Jun 15, 2023
1 parent 8f414f7 commit a9d0b4b
Show file tree
Hide file tree
Showing 7 changed files with 510 additions and 3 deletions.
17 changes: 17 additions & 0 deletions cmd/daemon/cniserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,23 @@ func CmdMain() {
}
}
}

if config.EnableVerboseConnCheck {
go func() {
connListenaddr := fmt.Sprintf("%s:%d", addr, config.TCPConnCheckPort)
if err := util.TCPConnectivityListen(connListenaddr); err != nil {
util.LogFatalAndExit(err, "failed to start TCP listen on addr %s ", addr)
}
}()

go func() {
connListenaddr := fmt.Sprintf("%s:%d", addr, config.UDPConnCheckPort)
if err := util.UDPConnectivityListen(connListenaddr); err != nil {
util.LogFatalAndExit(err, "failed to start UDP listen on addr %s ", addr)
}
}()
}

// conform to Gosec G114
// https://github.com/securego/gosec#available-rules
server := &http.Server{
Expand Down
16 changes: 16 additions & 0 deletions cmd/pinger/pinger.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ func CmdMain() {
}
util.LogFatalAndExit(server.ListenAndServe(), "failed to listen and serve on %s", server.Addr)
}()

if config.EnableVerboseConnCheck {
go func() {
addr := fmt.Sprintf("0.0.0.0:%d", config.TCPConnCheckPort)
if err := util.TCPConnectivityListen(addr); err != nil {
util.LogFatalAndExit(err, "failed to start TCP listen on addr %s ", addr)
}
}()

go func() {
addr := fmt.Sprintf("0.0.0.0:%d", config.UDPConnCheckPort)
if err := util.UDPConnectivityListen(addr); err != nil {
util.LogFatalAndExit(err, "failed to start UDP listen on addr %s ", addr)
}
}()
}
}
e := pinger.NewExporter(config)
pinger.StartPinger(config, e)
Expand Down

0 comments on commit a9d0b4b

Please sign in to comment.