Disable keep-alives on shutdown. (#1511)

See also: https://github.com/knative/pkg/issues/1509#issuecomment-659737054
This commit is contained in:
Matt Moore 2020-07-16 16:55:33 -07:00 committed by GitHub
parent 25f2aa6443
commit 0f78f8a8cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -219,6 +219,9 @@ func (wh *Webhook) Run(stop <-chan struct{}) error {
logger.Info("Starting to fail readiness probes...") logger.Info("Starting to fail readiness probes...")
close(wh.stopCh) 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 // 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. // endpoint to be removed from the webhook service's Endpoints.
// For this to be effective, it must be greater than the probe's // For this to be effective, it must be greater than the probe's