pkg/cri/streaming: increase ReadHeaderTimeout

It is follow-up of #7254. This commit will increase ReadHeaderTimeout
from 3s to 30m, which prevent from unexpected timeout when the node is
running with high-load. 30 Minutes is longer enough to get close to
before what #7254 changes.

And ideally, we should allow user to configure the streaming server if
the users want this feature.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
This commit is contained in:
Wei Fu 2022-08-13 17:19:05 +08:00
parent f0e1a27cbd
commit 460b0533b2

View File

@ -162,10 +162,11 @@ func NewServer(config Config, runtime Runtime) (Server, error) {
handler.Add(ws) handler.Add(ws)
s.handler = handler s.handler = handler
s.server = &http.Server{ s.server = &http.Server{
Addr: s.config.Addr, Addr: s.config.Addr,
Handler: s.handler, Handler: s.handler,
TLSConfig: s.config.TLSConfig, TLSConfig: s.config.TLSConfig,
ReadHeaderTimeout: 3 * time.Second, // Fix linter G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server // TODO(fuweid): allow user to configure streaming server
ReadHeaderTimeout: 30 * time.Minute, // Fix linter G112: Potential Slowloris Attack because ReadHeaderTimeout is not configured in the http.Server
} }
return s, nil return s, nil