Skip to content

Commit

Permalink
Merge pull request kubernetes#24656 from openshift-cherrypick-robot/c…
Browse files Browse the repository at this point in the history
…herry-pick-24650-to-release-4.4

[release-4.4] Bug 1811198: /readyz should start returning failure on shutdown initiation

Origin-commit: cd62f4529c30cb648bfcc5aea024620a0d72122e
  • Loading branch information
k8s-publishing-bot committed Mar 11, 2020
2 parents 8b3b0f5 + 588d31c commit 9dbee57
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion staging/src/k8s.io/apiserver/pkg/server/genericapiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,11 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
defer close(delayedStopCh)
<-stopCh

// As soon as shutdown is initiated, /readyz should start returning failure.
// This gives the load balancer a window defined by ShutdownDelayDuration to detect that /readyz is red
// and stop sending traffic to this server.
close(s.readinessStopCh)

s.Eventf(corev1.EventTypeNormal, "TerminationStart", "Received signal to terminate, becoming unready, but keeping serving")

time.Sleep(s.ShutdownDelayDuration)
Expand Down Expand Up @@ -396,7 +401,6 @@ func (s preparedGenericAPIServer) NonBlockingRun(stopCh <-chan struct{}) error {
// ensure cleanup.
go func() {
<-stopCh
close(s.readinessStopCh)
close(internalStopCh)
if stoppedCh != nil {
<-stoppedCh
Expand Down

0 comments on commit 9dbee57

Please sign in to comment.