@@ -47,16 +47,17 @@ const (
47
47
type ServerRunOptions struct {
48
48
AdvertiseAddress net.IP
49
49
50
- CorsAllowedOriginList []string
51
- HSTSDirectives []string
52
- ExternalHost string
53
- MaxRequestsInFlight int
54
- MaxMutatingRequestsInFlight int
55
- RequestTimeout time.Duration
56
- GoawayChance float64
57
- LivezGracePeriod time.Duration
58
- MinRequestTimeout int
59
- ShutdownDelayDuration time.Duration
50
+ CorsAllowedOriginList []string
51
+ HSTSDirectives []string
52
+ ExternalHost string
53
+ MaxRequestsInFlight int
54
+ MaxMutatingRequestsInFlight int
55
+ RequestTimeout time.Duration
56
+ GoawayChance float64
57
+ LivezGracePeriod time.Duration
58
+ MinRequestTimeout int
59
+ StorageInitializationTimeout time.Duration
60
+ ShutdownDelayDuration time.Duration
60
61
// We intentionally did not add a flag for this option. Users of the
61
62
// apiserver library can wire it to a flag.
62
63
JSONPatchMaxCopyBytes int64
@@ -116,6 +117,7 @@ func NewServerRunOptionsForComponent(componentName string, componentGlobalsRegis
116
117
RequestTimeout : defaults .RequestTimeout ,
117
118
LivezGracePeriod : defaults .LivezGracePeriod ,
118
119
MinRequestTimeout : defaults .MinRequestTimeout ,
120
+ StorageInitializationTimeout : defaults .StorageInitializationTimeout ,
119
121
ShutdownDelayDuration : defaults .ShutdownDelayDuration ,
120
122
ShutdownWatchTerminationGracePeriod : defaults .ShutdownWatchTerminationGracePeriod ,
121
123
JSONPatchMaxCopyBytes : defaults .JSONPatchMaxCopyBytes ,
@@ -140,6 +142,7 @@ func (s *ServerRunOptions) ApplyTo(c *server.Config) error {
140
142
c .RequestTimeout = s .RequestTimeout
141
143
c .GoawayChance = s .GoawayChance
142
144
c .MinRequestTimeout = s .MinRequestTimeout
145
+ c .StorageInitializationTimeout = s .StorageInitializationTimeout
143
146
c .ShutdownDelayDuration = s .ShutdownDelayDuration
144
147
c .JSONPatchMaxCopyBytes = s .JSONPatchMaxCopyBytes
145
148
c .MaxRequestBodyBytes = s .MaxRequestBodyBytes
@@ -197,6 +200,10 @@ func (s *ServerRunOptions) Validate() []error {
197
200
errors = append (errors , fmt .Errorf ("--min-request-timeout can not be negative value" ))
198
201
}
199
202
203
+ if s .StorageInitializationTimeout < 0 {
204
+ errors = append (errors , fmt .Errorf ("--storage-initialization-timeout can not be negative value" ))
205
+ }
206
+
200
207
if s .ShutdownDelayDuration < 0 {
201
208
errors = append (errors , fmt .Errorf ("--shutdown-delay-duration can not be negative value" ))
202
209
}
@@ -350,6 +357,9 @@ func (s *ServerRunOptions) AddUniversalFlags(fs *pflag.FlagSet) {
350
357
"handler, which picks a randomized value above this number as the connection timeout, " +
351
358
"to spread out load." )
352
359
360
+ fs .DurationVar (& s .StorageInitializationTimeout , "storage-initialization-timeout" , s .StorageInitializationTimeout ,
361
+ "Maximum amount of time to wait for storage initialization before declaring apiserver ready. Defaults to 1m." )
362
+
353
363
fs .DurationVar (& s .ShutdownDelayDuration , "shutdown-delay-duration" , s .ShutdownDelayDuration , "" +
354
364
"Time to delay the termination. During that time the server keeps serving requests normally. The endpoints /healthz and /livez " +
355
365
"will return success, but /readyz immediately returns failure. Graceful termination starts after this delay " +
0 commit comments