Skip to content

Commit

Permalink
Kubectl ko diagnose perf release 1.10 (#2966)
Browse files Browse the repository at this point in the history
* kubectl ko diagenose perf add to install.sh

* diagnose subnet and kubectl ko perf refactor
  • Loading branch information
changluyi authored Jun 20, 2023
1 parent a15d5db commit d8b7989
Show file tree
Hide file tree
Showing 8 changed files with 702 additions and 9 deletions.
17 changes: 17 additions & 0 deletions cmd/daemon/cniserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,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 @@ -34,6 +34,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
Loading

0 comments on commit d8b7989

Please sign in to comment.