mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #88911 from tkashem/readyz-shutdown
/readyz should start returning failure on shutdown initiation
This commit is contained in:
commit
ab40772439
@ -318,8 +318,14 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer close(delayedStopCh)
|
defer close(delayedStopCh)
|
||||||
|
|
||||||
<-stopCh
|
<-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)
|
||||||
|
|
||||||
time.Sleep(s.ShutdownDelayDuration)
|
time.Sleep(s.ShutdownDelayDuration)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -379,7 +385,6 @@ func (s preparedGenericAPIServer) NonBlockingRun(stopCh <-chan struct{}) error {
|
|||||||
// ensure cleanup.
|
// ensure cleanup.
|
||||||
go func() {
|
go func() {
|
||||||
<-stopCh
|
<-stopCh
|
||||||
close(s.readinessStopCh)
|
|
||||||
close(internalStopCh)
|
close(internalStopCh)
|
||||||
if stoppedCh != nil {
|
if stoppedCh != nil {
|
||||||
<-stoppedCh
|
<-stoppedCh
|
||||||
|
Loading…
Reference in New Issue
Block a user