fix(kube-ovn): bound webhook server request timeouts

The webhook http.Server set no read, write, or idle timeout, so a client that
opens a connection and sends headers slowly could hold a goroutine and file
descriptor indefinitely. Add ReadHeaderTimeout, ReadTimeout, WriteTimeout, and
IdleTimeout.

Signed-off-by: IvanHunters <xorokhotnikov@gmail.com>
(cherry picked from commit 4151885871)
This commit is contained in:
IvanHunters authored and github-actions[bot] committed 2026-08-10 09:50:01 +00:00
1 parent d2dc85f712
commit 90409213f8
1 file changed
+8 -3
@@ -4,6 +4,7 @@ import (
"flag"
"log"
"net/http"
"time"
)
var (
@@ -33,9 +34,13 @@ func main() {
}
server := &http.Server{
Addr: ":8443",
TLSConfig: tlsConfig,
Handler: mux,
Addr: ":8443",
TLSConfig: tlsConfig,
Handler: mux,
ReadHeaderTimeout: 10 * time.Second,
ReadTimeout: 30 * time.Second,
WriteTimeout: 30 * time.Second,
IdleTimeout: 60 * time.Second,
}
log.Printf("Starting webhook server on %s", server.Addr)