mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
remove logging from the Signal method
This commit is contained in:
parent
dae08bc3a7
commit
6c88a62cb4
@ -338,6 +338,7 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer delayedStopCh.Signal()
|
defer delayedStopCh.Signal()
|
||||||
|
defer klog.V(1).InfoS("[graceful-termination] shutdown event", "name", delayedStopCh.Name())
|
||||||
|
|
||||||
<-stopCh
|
<-stopCh
|
||||||
|
|
||||||
@ -345,6 +346,7 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
|||||||
// This gives the load balancer a window defined by ShutdownDelayDuration to detect that /readyz is red
|
// This gives the load balancer a window defined by ShutdownDelayDuration to detect that /readyz is red
|
||||||
// and stop sending traffic to this server.
|
// and stop sending traffic to this server.
|
||||||
shutdownInitiatedCh.Signal()
|
shutdownInitiatedCh.Signal()
|
||||||
|
klog.V(1).InfoS("[graceful-termination] shutdown event", "name", shutdownInitiatedCh.Name())
|
||||||
|
|
||||||
time.Sleep(s.ShutdownDelayDuration)
|
time.Sleep(s.ShutdownDelayDuration)
|
||||||
}()
|
}()
|
||||||
@ -358,11 +360,13 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
|||||||
go func() {
|
go func() {
|
||||||
<-listenerStoppedCh
|
<-listenerStoppedCh
|
||||||
httpServerStoppedListeningCh.Signal()
|
httpServerStoppedListeningCh.Signal()
|
||||||
|
klog.V(1).InfoS("[graceful-termination] shutdown event", "name", httpServerStoppedListeningCh.Name())
|
||||||
}()
|
}()
|
||||||
|
|
||||||
drainedCh := s.lifecycleSignals.InFlightRequestsDrained
|
drainedCh := s.lifecycleSignals.InFlightRequestsDrained
|
||||||
go func() {
|
go func() {
|
||||||
defer drainedCh.Signal()
|
defer drainedCh.Signal()
|
||||||
|
defer klog.V(1).InfoS("[graceful-termination] shutdown event", "name", drainedCh.Name())
|
||||||
|
|
||||||
// wait for the delayed stopCh before closing the handler chain (it rejects everything after Wait has been called).
|
// wait for the delayed stopCh before closing the handler chain (it rejects everything after Wait has been called).
|
||||||
<-delayedStopCh.Signaled()
|
<-delayedStopCh.Signaled()
|
||||||
|
@ -16,10 +16,6 @@ limitations under the License.
|
|||||||
|
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
|
||||||
"k8s.io/klog/v2"
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We make an attempt here to identify the events that take place during
|
We make an attempt here to identify the events that take place during
|
||||||
lifecycle of the apiserver.
|
lifecycle of the apiserver.
|
||||||
@ -69,6 +65,9 @@ type lifecycleSignal interface {
|
|||||||
// Signaled returns a channel that is closed when the underlying event
|
// Signaled returns a channel that is closed when the underlying event
|
||||||
// has been signaled. Successive calls to Signaled return the same value.
|
// has been signaled. Successive calls to Signaled return the same value.
|
||||||
Signaled() <-chan struct{}
|
Signaled() <-chan struct{}
|
||||||
|
|
||||||
|
// Name returns the name of the signal, useful for logging.
|
||||||
|
Name() string
|
||||||
}
|
}
|
||||||
|
|
||||||
// lifecycleSignals provides an abstraction of the events that
|
// lifecycleSignals provides an abstraction of the events that
|
||||||
@ -127,10 +126,13 @@ func (e *namedChannelWrapper) Signal() {
|
|||||||
// already closed, don't close again.
|
// already closed, don't close again.
|
||||||
default:
|
default:
|
||||||
close(e.ch)
|
close(e.ch)
|
||||||
klog.V(1).InfoS("[graceful-termination] shutdown event", "name", e.name)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *namedChannelWrapper) Signaled() <-chan struct{} {
|
func (e *namedChannelWrapper) Signaled() <-chan struct{} {
|
||||||
return e.ch
|
return e.ch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (e *namedChannelWrapper) Name() string {
|
||||||
|
return e.name
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user