@@ -27,19 +27,22 @@ import (
2727
2828// ServerRunOptions is the extension option for configuring the APIServer
2929type ServerRunOptions struct {
30- RequestTimeout time.Duration
30+ RequestTimeout time.Duration
31+ MinRequestTimeout int
3132}
3233
3334func NewServerRunOptions () * ServerRunOptions {
3435 defaults := server .NewConfig (serializer.CodecFactory {})
3536 return & ServerRunOptions {
36- RequestTimeout : defaults .RequestTimeout ,
37+ RequestTimeout : defaults .RequestTimeout ,
38+ MinRequestTimeout : defaults .MinRequestTimeout ,
3739 }
3840}
3941
4042// ApplyTo set the params in server.RecommendConfig
4143func (s * ServerRunOptions ) ApplyTo (c * server.Config ) error {
4244 c .RequestTimeout = s .RequestTimeout
45+ c .MinRequestTimeout = s .MinRequestTimeout
4346 return nil
4447}
4548
@@ -49,6 +52,11 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
4952 "An optional field indicating the duration a handler must keep a request open before timing " +
5053 "it out. This is the default request timeout for requests but may be overridden by flags such as " +
5154 "--min-request-timeout for specific types of requests." )
55+ fs .IntVar (& s .MinRequestTimeout , "min-request-timeout" , s .MinRequestTimeout , "" +
56+ "An optional field indicating the minimum number of seconds a handler must keep " +
57+ "a request open before timing it out. Currently only honored by the watch request " +
58+ "handler, which picks a randomized value above this number as the connection timeout, " +
59+ "to spread out load." )
5260}
5361
5462var defaultServerRunOptions = NewServerRunOptions ()
0 commit comments