diff --git a/pkg/flags/flags.go b/pkg/flags/flags.go index ce24160fd..8f1ee1190 100644 --- a/pkg/flags/flags.go +++ b/pkg/flags/flags.go @@ -222,9 +222,11 @@ Takes the form ":port". If not provided, no admission controller is starte statusUpdateInterval = flags.Int("status-update-interval", status.UpdateInterval, "Time interval in seconds in which the status should check if an update is required. Default is 60 seconds") - shutdownGracePeriod = flags.Int("shutdown-grace-period", 0, "Seconds to wait after receiving the shutdown signal, before stopping the nginx process.") + shutdownGracePeriod = flags.Int("shutdown-grace-period", 10, "Seconds to wait after receiving the shutdown signal, before stopping the nginx process.") - postShutdownGracePeriod = flags.Int("post-shutdown-grace-period", 10, "Seconds to wait after the nginx process has stopped before controller exits.") + postShutdownGracePeriod = flags.Int("post-shutdown-grace-period", 0, `[IN DEPRECATION] Seconds to wait after the nginx process has stopped before controller exits. +Note that increasing this value doesn't seem to contribute to graceful shutdown of the ingress controller. +If you would like to configure period for accepting requests before shutting down, use 'shutdown-grace-period' instead.'`) deepInspector = flags.Bool("deep-inspect", true, "Enables ingress object security deep inspector") diff --git a/pkg/util/process/sigterm.go b/pkg/util/process/sigterm.go index 1c0d729c1..689947c80 100644 --- a/pkg/util/process/sigterm.go +++ b/pkg/util/process/sigterm.go @@ -17,12 +17,11 @@ limitations under the License. package process import ( + klog "k8s.io/klog/v2" "os" "os/signal" "syscall" "time" - - klog "k8s.io/klog/v2" ) type exiter func(code int) @@ -41,8 +40,11 @@ func HandleSigterm(ngx Controller, delay int, exit exiter) { exitCode = 1 } - klog.Infof("Handled quit, delaying controller exit for %d seconds", delay) - time.Sleep(time.Duration(delay) * time.Second) + if delay > 0 { + klog.Warning("[DEPRECATED] Delaying controller exit for %d seconds", delay) + klog.Warning("[DEPRECATED] 'post-shutdown-grace-period' does not have any effect for graceful shutdown - use 'shutdown-grace-period' flag instead.") + time.Sleep(time.Duration(delay) * time.Second) + } klog.InfoS("Exiting", "code", exitCode) exit(exitCode)