Skip to content

Commit

Permalink
fix ovn-montior bind failed
Browse files Browse the repository at this point in the history
Signed-off-by: zhaocongqi <[email protected]>
  • Loading branch information
zhaocongqi committed Dec 31, 2024
1 parent 4f1463c commit 96d87bb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cmd/ovn_monitor/ovn_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func CmdMain() {
addr := config.ListenAddress
if os.Getenv("ENABLE_BIND_LOCAL_IP") == "true" {
if ips := strings.Split(os.Getenv("POD_IPS"), ","); len(ips) == 1 {
addr = ips[0]
addr = util.JoinHostPort(ips[0], port)
}
}

Expand All @@ -51,13 +51,12 @@ func CmdMain() {
go exporter.TryClientConnection()
}
exporter.StartOvnMetrics()
addr = util.JoinHostPort(addr, port)
if err = metrics.Run(ctx, nil, addr, config.SecureServing, false); err != nil {
util.LogFatalAndExit(err, "failed to run metrics server")
}
} else {
klog.Info("metrics server is disabled")
listerner, err := net.ListenTCP("tcp", &net.TCPAddr{IP: net.ParseIP(addr), Port: int(port)})
listerner, err := net.ListenTCP("tcp", &net.TCPAddr{IP: net.ParseIP(util.GetDefaultListenAddr()), Port: int(port)})
if err != nil {
util.LogFatalAndExit(err, "failed to listen on %s", util.JoinHostPort(addr, port))
}
Expand Down

0 comments on commit 96d87bb

Please sign in to comment.