@@ -156,8 +156,10 @@ type Config struct {
156156
157157 // BuildHandlerChainFunc allows you to build custom handler chains by decorating the apiHandler.
158158 BuildHandlerChainFunc func (apiHandler http.Handler , c * Config ) (secure http.Handler )
159- // HandlerChainWaitGroup allows you to wait for all chain handlers exit after the server shutdown.
160- HandlerChainWaitGroup * utilwaitgroup.SafeWaitGroup
159+ // NonLongRunningRequestWaitGroup allows you to wait for all chain
160+ // handlers associated with non long-running requests
161+ // to complete while the server is shuting down.
162+ NonLongRunningRequestWaitGroup * utilwaitgroup.SafeWaitGroup
161163 // DiscoveryAddresses is used to build the IPs pass to discovery. If nil, the ExternalAddress is
162164 // always reported
163165 DiscoveryAddresses discovery.Addresses
@@ -349,26 +351,26 @@ func NewConfig(codecs serializer.CodecFactory) *Config {
349351 lifecycleSignals := newLifecycleSignals ()
350352
351353 return & Config {
352- Serializer : codecs ,
353- BuildHandlerChainFunc : DefaultBuildHandlerChain ,
354- HandlerChainWaitGroup : new (utilwaitgroup.SafeWaitGroup ),
355- LegacyAPIGroupPrefixes : sets .NewString (DefaultLegacyAPIPrefix ),
356- DisabledPostStartHooks : sets .NewString (),
357- PostStartHooks : map [string ]PostStartHookConfigEntry {},
358- HealthzChecks : append ([]healthz.HealthChecker {}, defaultHealthChecks ... ),
359- ReadyzChecks : append ([]healthz.HealthChecker {}, defaultHealthChecks ... ),
360- LivezChecks : append ([]healthz.HealthChecker {}, defaultHealthChecks ... ),
361- EnableIndex : true ,
362- EnableDiscovery : true ,
363- EnableProfiling : true ,
364- DebugSocketPath : "" ,
365- EnableMetrics : true ,
366- MaxRequestsInFlight : 400 ,
367- MaxMutatingRequestsInFlight : 200 ,
368- RequestTimeout : time .Duration (60 ) * time .Second ,
369- MinRequestTimeout : 1800 ,
370- LivezGracePeriod : time .Duration (0 ),
371- ShutdownDelayDuration : time .Duration (0 ),
354+ Serializer : codecs ,
355+ BuildHandlerChainFunc : DefaultBuildHandlerChain ,
356+ NonLongRunningRequestWaitGroup : new (utilwaitgroup.SafeWaitGroup ),
357+ LegacyAPIGroupPrefixes : sets .NewString (DefaultLegacyAPIPrefix ),
358+ DisabledPostStartHooks : sets .NewString (),
359+ PostStartHooks : map [string ]PostStartHookConfigEntry {},
360+ HealthzChecks : append ([]healthz.HealthChecker {}, defaultHealthChecks ... ),
361+ ReadyzChecks : append ([]healthz.HealthChecker {}, defaultHealthChecks ... ),
362+ LivezChecks : append ([]healthz.HealthChecker {}, defaultHealthChecks ... ),
363+ EnableIndex : true ,
364+ EnableDiscovery : true ,
365+ EnableProfiling : true ,
366+ DebugSocketPath : "" ,
367+ EnableMetrics : true ,
368+ MaxRequestsInFlight : 400 ,
369+ MaxMutatingRequestsInFlight : 200 ,
370+ RequestTimeout : time .Duration (60 ) * time .Second ,
371+ MinRequestTimeout : 1800 ,
372+ LivezGracePeriod : time .Duration (0 ),
373+ ShutdownDelayDuration : time .Duration (0 ),
372374 // 1.5MB is the default client request size in bytes
373375 // the etcd server should accept. See
374376 // https://github.com/etcd-io/etcd/blob/release-3.4/embed/config.go#L56.
@@ -641,18 +643,18 @@ func (c completedConfig) New(name string, delegationTarget DelegationTarget) (*G
641643 apiServerHandler := NewAPIServerHandler (name , c .Serializer , handlerChainBuilder , delegationTarget .UnprotectedHandler ())
642644
643645 s := & GenericAPIServer {
644- discoveryAddresses : c .DiscoveryAddresses ,
645- LoopbackClientConfig : c .LoopbackClientConfig ,
646- legacyAPIGroupPrefixes : c .LegacyAPIGroupPrefixes ,
647- admissionControl : c .AdmissionControl ,
648- Serializer : c .Serializer ,
649- AuditBackend : c .AuditBackend ,
650- Authorizer : c .Authorization .Authorizer ,
651- delegationTarget : delegationTarget ,
652- EquivalentResourceRegistry : c .EquivalentResourceRegistry ,
653- HandlerChainWaitGroup : c . HandlerChainWaitGroup ,
654- Handler : apiServerHandler ,
655- UnprotectedDebugSocket : debugSocket ,
646+ discoveryAddresses : c .DiscoveryAddresses ,
647+ LoopbackClientConfig : c .LoopbackClientConfig ,
648+ legacyAPIGroupPrefixes : c .LegacyAPIGroupPrefixes ,
649+ admissionControl : c .AdmissionControl ,
650+ Serializer : c .Serializer ,
651+ AuditBackend : c .AuditBackend ,
652+ Authorizer : c .Authorization .Authorizer ,
653+ delegationTarget : delegationTarget ,
654+ EquivalentResourceRegistry : c .EquivalentResourceRegistry ,
655+ NonLongRunningRequestWaitGroup : c . NonLongRunningRequestWaitGroup ,
656+ Handler : apiServerHandler ,
657+ UnprotectedDebugSocket : debugSocket ,
656658
657659 listedPathProvider : apiServerHandler ,
658660
@@ -887,7 +889,7 @@ func DefaultBuildHandlerChain(apiHandler http.Handler, c *Config) http.Handler {
887889
888890 handler = genericapifilters .WithRequestDeadline (handler , c .AuditBackend , c .AuditPolicyRuleEvaluator ,
889891 c .LongRunningFunc , c .Serializer , c .RequestTimeout )
890- handler = genericfilters .WithWaitGroup (handler , c .LongRunningFunc , c .HandlerChainWaitGroup )
892+ handler = genericfilters .WithWaitGroup (handler , c .LongRunningFunc , c .NonLongRunningRequestWaitGroup )
891893 if c .SecureServing != nil && ! c .SecureServing .DisableHTTP2 && c .GoawayChance > 0 {
892894 handler = genericfilters .WithProbabilisticGoaway (handler , c .GoawayChance )
893895 }
0 commit comments