From 0f78f8a8cccf2c2a0cf5c20c6eddf9e04725f6af Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Thu, 16 Jul 2020 16:55:33 -0700 Subject: [PATCH] Disable keep-alives on shutdown. (#1511) See also: https://github.com/knative/pkg/issues/1509#issuecomment-659737054 --- webhook/webhook.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webhook/webhook.go b/webhook/webhook.go index 1a2988c1c..6052d717a 100644 --- a/webhook/webhook.go +++ b/webhook/webhook.go @@ -219,6 +219,9 @@ func (wh *Webhook) Run(stop <-chan struct{}) error { logger.Info("Starting to fail readiness probes...") close(wh.stopCh) + // As we start to shutdown, disable keep-alives to avoid clients hanging onto connections. + server.SetKeepAlivesEnabled(false) + // Wait for a grace period for the above to take effect and this Pod's // endpoint to be removed from the webhook service's Endpoints. // For this to be effective, it must be greater than the probe's