Diagram for graceful shutdown

Kubernetes-commit: 1145582de367b9aa4072e631845ce3abc37b8540
This commit is contained in:
Wojciech Tyczyński 2022-05-12 17:22:36 +02:00 committed by Kubernetes Publisher
parent 9b5acf1cdd
commit 30c4077e0e
1 changed files with 27 additions and 0 deletions

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