Commit f50761c9 authored by Kevin's avatar Kevin

fix prober ticking shift for kubelet restarted cases

parent 92e1f446
......@@ -99,6 +99,11 @@ func newWorker(
// run periodically probes the container.
func (w *worker) run() {
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)
defer func() {
......@@ -111,10 +116,6 @@ func (w *worker) run() {
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:
for w.doProbe() {
// Wait for next probe tick.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment