Merge pull request #110081 from wojtek-t/document_shutdown_sequence

Diagram for graceful shutdown
This commit is contained in:
Kubernetes Prow Robot 2022-05-17 06:20:39 -07:00 committed by GitHub
commit c79b909de7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -421,6 +421,33 @@ func (s *GenericAPIServer) PrepareRun() preparedGenericAPIServer {
// Run spawns the secure http server. It only returns if stopCh is closed
// or the secure port cannot be listened on initially.
// This is the diagram of what channels/signals are dependent on each other:
//
// stopCh
// |
// ---------------------------------------------------------
// | |
// ShutdownInitiated (shutdownInitiatedCh) |
// | |
// (ShutdownDelayDuration) (PreShutdownHooks)
// | |
// AfterShutdownDelayDuration (delayedStopCh) preShutdownHooksHasStoppedCh
// | |
// |---------------------------------- |
// | | |
// | (HandlerChainWaitGroup::Wait) |
// | | |
// | InFlightRequestsDrained (drainedCh) |
// | | |
// [without ShutdownSendRetryAfter] [with ShutdownSendRetryAfter] |
// | | |
// ---------------------------------------------------------
// |
// stopHttpServerCh
// |
// listenerStoppedCh
// |
// HTTPServerStoppedListening (httpServerStoppedListeningCh)
func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
delayedStopCh := s.lifecycleSignals.AfterShutdownDelayDuration
shutdownInitiatedCh := s.lifecycleSignals.ShutdownInitiated