mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
fix prober ticking shift for kubelet restarted cases
This commit is contained in:
parent
92e1f4466e
commit
f50761c9d4
@ -99,6 +99,11 @@ func newWorker(
|
|||||||
// run periodically probes the container.
|
// run periodically probes the container.
|
||||||
func (w *worker) run() {
|
func (w *worker) run() {
|
||||||
probeTickerPeriod := time.Duration(w.spec.PeriodSeconds) * time.Second
|
probeTickerPeriod := time.Duration(w.spec.PeriodSeconds) * time.Second
|
||||||
|
|
||||||
|
// If kubelet restarted the probes could be started in rapid succession.
|
||||||
|
// Let the worker wait for a random portion of tickerPeriod before probing.
|
||||||
|
time.Sleep(time.Duration(rand.Float64() * float64(probeTickerPeriod)))
|
||||||
|
|
||||||
probeTicker := time.NewTicker(probeTickerPeriod)
|
probeTicker := time.NewTicker(probeTickerPeriod)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -111,10 +116,6 @@ func (w *worker) run() {
|
|||||||
w.probeManager.removeWorker(w.pod.UID, w.container.Name, w.probeType)
|
w.probeManager.removeWorker(w.pod.UID, w.container.Name, w.probeType)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// If kubelet restarted the probes could be started in rapid succession.
|
|
||||||
// Let the worker wait for a random portion of tickerPeriod before probing.
|
|
||||||
time.Sleep(time.Duration(rand.Float64() * float64(probeTickerPeriod)))
|
|
||||||
|
|
||||||
probeLoop:
|
probeLoop:
|
||||||
for w.doProbe() {
|
for w.doProbe() {
|
||||||
// Wait for next probe tick.
|
// Wait for next probe tick.
|
||||||
|
Loading…
Reference in New Issue
Block a user