Fix duplicated rate limit in scheduler

Remove BindingRateLimiterSaturation metrics

Update generated doc
This commit is contained in:
harry
2015-12-28 17:04:29 +08:00
committed by Harry Zhang
parent e1a71fefaa
commit 080cb60dab
13 changed files with 20 additions and 123 deletions

View File

@@ -76,10 +76,6 @@ type Config struct {
Algorithm algorithm.ScheduleAlgorithm
Binder Binder
// Rate at which we can create pods
// If this field is nil, we don't have any rate limit.
BindPodsRateLimiter util.RateLimiter
// NextPod should be a function that blocks until the next pod
// is available. We don't use a channel for this, because scheduling
// a pod may take some amount of time and we don't want pods to get
@@ -108,20 +104,11 @@ func New(c *Config) *Scheduler {
// Run begins watching and scheduling. It starts a goroutine and returns immediately.
func (s *Scheduler) Run() {
if s.config.BindPodsRateLimiter != nil {
go util.Forever(func() {
sat := s.config.BindPodsRateLimiter.Saturation()
metrics.BindingRateLimiterSaturation.Set(sat)
}, metrics.BindingSaturationReportInterval)
}
go util.Until(s.scheduleOne, 0, s.config.StopEverything)
}
func (s *Scheduler) scheduleOne() {
pod := s.config.NextPod()
if s.config.BindPodsRateLimiter != nil {
s.config.BindPodsRateLimiter.Accept()
}
glog.V(3).Infof("Attempting to schedule: %+v", pod)
start := time.Now()