mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 07:27:21 +00:00
Fix duplicated rate limit in scheduler
Remove BindingRateLimiterSaturation metrics Update generated doc
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user