kube-proxy can read config from the apiserver

All clients that talk to a "master" as a host:port or URL
(scheme://host:port) parameter.  Add tests.
This commit is contained in:
Clayton Coleman
2014-08-15 17:14:22 -04:00
parent 083d81b6d7
commit 9006eadcfe
9 changed files with 393 additions and 17 deletions

View File

@@ -18,9 +18,21 @@ package wait
import (
"errors"
"math/rand"
"time"
)
// Jitter returns a time.Duration between duration and duration + maxFactor * duration,
// to allow clients to avoid converging on periodic behavior. If maxFactor is 0.0, a
// suggested default value will be chosen.
func Jitter(duration time.Duration, maxFactor float64) time.Duration {
if maxFactor <= 0.0 {
maxFactor = 1.0
}
wait := duration + time.Duration(rand.Float64()*maxFactor*float64(duration))
return wait
}
// ErrWaitTimeout is returned when the condition exited without success
var ErrWaitTimeout = errors.New("timed out waiting for the condition")