mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +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() {
|
||||
defer delayedStopCh.Signal()
|
||||
defer klog.V(1).InfoS("[graceful-termination] shutdown event", "name", delayedStopCh.Name())
|
||||
|
||||
<-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
|
||||
// and stop sending traffic to this server.
|
||||
shutdownInitiatedCh.Signal()
|
||||
klog.V(1).InfoS("[graceful-termination] shutdown event", "name", shutdownInitiatedCh.Name())
|
||||
|
||||
time.Sleep(s.ShutdownDelayDuration)
|
||||
}()
|
||||
@ -358,11 +360,13 @@ func (s preparedGenericAPIServer) Run(stopCh <-chan struct{}) error {
|
||||
go func() {
|
||||
<-listenerStoppedCh
|
||||
httpServerStoppedListeningCh.Signal()
|
||||
klog.V(1).InfoS("[graceful-termination] shutdown event", "name", httpServerStoppedListeningCh.Name())
|
||||
}()
|
||||
|
||||
drainedCh := s.lifecycleSignals.InFlightRequestsDrained
|
||||
go func() {
|
||||
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).
|
||||
<-delayedStopCh.Signaled()
|
||||
|
@ -16,10 +16,6 @@ limitations under the License.
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"k8s.io/klog/v2"
|
||||
)
|
||||
|
||||
/*
|
||||
We make an attempt here to identify the events that take place during
|
||||
lifecycle of the apiserver.
|
||||
@ -69,6 +65,9 @@ type lifecycleSignal interface {
|
||||
// Signaled returns a channel that is closed when the underlying event
|
||||
// has been signaled. Successive calls to Signaled return the same value.
|
||||
Signaled() <-chan struct{}
|
||||
|
||||
// Name returns the name of the signal, useful for logging.
|
||||
Name() string
|
||||
}
|
||||
|
||||
// lifecycleSignals provides an abstraction of the events that
|
||||
@ -127,10 +126,13 @@ func (e *namedChannelWrapper) Signal() {
|
||||
// already closed, don't close again.
|
||||
default:
|
||||
close(e.ch)
|
||||
klog.V(1).InfoS("[graceful-termination] shutdown event", "name", e.name)
|
||||
}
|
||||
}
|
||||
|
||||
func (e *namedChannelWrapper) Signaled() <-chan struct{} {
|
||||
return e.ch
|
||||
}
|
||||
|
||||
func (e *namedChannelWrapper) Name() string {
|
||||
return e.name
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user