mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
apiserver: refactor graceful termination test
This commit is contained in:
parent
a1c8e9386a
commit
f28710bc46
@ -544,10 +544,22 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
|||||||
defer drainedCh.Signal()
|
defer drainedCh.Signal()
|
||||||
defer klog.V(1).InfoS("[graceful-termination] shutdown event", "name", drainedCh.Name())
|
defer klog.V(1).InfoS("[graceful-termination] shutdown event", "name", drainedCh.Name())
|
||||||
|
|
||||||
// wait for the delayed stopCh before closing the handler chain (it rejects everything after Wait has been called).
|
// wait for the delayed stopCh before closing the handler chain
|
||||||
<-delayedStopCh.Signaled()
|
<-delayedStopCh.Signaled()
|
||||||
|
|
||||||
// Wait for all requests to finish, which are bounded by the RequestTimeout variable.
|
// Wait for all requests to finish, which are bounded by the RequestTimeout variable.
|
||||||
|
// once HandlerChainWaitGroup.Wait is invoked, the apiserver is
|
||||||
|
// expected to reject any incoming request with a {503, Retry-After}
|
||||||
|
// response via the WithWaitGroup filter. On the contrary, we observe
|
||||||
|
// that incoming request(s) get a 'connection refused' error, this is
|
||||||
|
// because, at this point, we have called 'Server.Shutdown' and
|
||||||
|
// net/http server has stopped listening. This causes incoming
|
||||||
|
// request to get a 'connection refused' error.
|
||||||
|
// On the other hand, if 'ShutdownSendRetryAfter' is enabled incoming
|
||||||
|
// requests will be rejected with a {429, Retry-After} since
|
||||||
|
// 'Server.Shutdown' will be invoked only after in-flight requests
|
||||||
|
// have been drained.
|
||||||
|
// TODO: can we consolidate these two modes of graceful termination?
|
||||||
s.HandlerChainWaitGroup.Wait()
|
s.HandlerChainWaitGroup.Wait()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user