Add flag to allow setting a shutdown grace period

This commit is contained in:
Björn Carlsson 2020-07-06 21:05:16 +02:00
parent 032fccb292
commit 54b13bd216
6 changed files with 140 additions and 0 deletions

View file

@ -106,6 +106,8 @@ type Configuration struct {
MaxmindEditionFiles []string
MonitorMaxBatchSize int
ShutdownGracePeriod int
}
// GetPublishService returns the Service used to set the load-balancer status of Ingresses.

View file

@ -367,6 +367,8 @@ func (n *NGINXController) Stop() error {
return fmt.Errorf("shutdown already in progress")
}
time.Sleep(time.Duration(n.cfg.ShutdownGracePeriod) * time.Second)
klog.InfoS("Shutting down controller queues")
close(n.stopCh)
go n.syncQueue.Shutdown()