Skip to content

Commit fb1d5d2

Browse files
committed
Allow to set GracefulShutdownTimeout to -1, disabling timeouts
Signed-off-by: Vince Prignano <[email protected]>
1 parent 6adc01f commit fb1d5d2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/manager/internal.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,12 @@ func (cm *controllerManager) engageStopProcedure(stopComplete <-chan struct{}) e
509509
//
510510
// The shutdown context immediately expires if the gracefulShutdownTimeout is not set.
511511
var shutdownCancel context.CancelFunc
512-
cm.shutdownCtx, shutdownCancel = context.WithTimeout(context.Background(), cm.gracefulShutdownTimeout)
512+
if cm.gracefulShutdownTimeout < 0 {
513+
// We want to wait forever for the runnables to stop.
514+
cm.shutdownCtx, shutdownCancel = context.WithCancel(context.Background())
515+
} else {
516+
cm.shutdownCtx, shutdownCancel = context.WithTimeout(context.Background(), cm.gracefulShutdownTimeout)
517+
}
513518
defer shutdownCancel()
514519

515520
// Start draining the errors before acquiring the lock to make sure we don't deadlock

0 commit comments

Comments
 (0)