Skip to content

Commit

Permalink
Merge pull request #289 from klihub/fixes/disable-rebalancing
Browse files Browse the repository at this point in the history
resource-manager: disable periodic rebalancing by default.
  • Loading branch information
ipuustin authored May 19, 2020
2 parents a9674be + 9347520 commit 215f1f4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions pkg/cri/resource-manager/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,25 @@ func (m *resmgr) startEventProcessing() error {

stop := m.stop
go func() {
rebalanceTimer := time.NewTicker(opt.RebalanceTimer)
var rebalanceTimer *time.Ticker
var rebalanceChan <-chan time.Time

if opt.RebalanceTimer > 0 {
rebalanceTimer = time.NewTicker(opt.RebalanceTimer)
rebalanceChan = rebalanceTimer.C
} else {
m.Info("periodic rebalancing is disabled")
}
for {
select {
case _ = <-stop:
if rebalanceTimer != nil {
rebalanceTimer.Stop()
}
return
case event := <-m.events:
m.processEvent(event)
case _ = <-rebalanceTimer.C:
case _ = <-rebalanceChan:
if err := m.RebalanceContainers(); err != nil {
evtlog.Error("rebalancing failed: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/cri/resource-manager/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func init() {

flag.DurationVar(&opt.MetricsTimer, "metrics-interval", 0,
"Interval for polling/gathering runtime metrics data. Use 'disable' for disabling.")
flag.DurationVar(&opt.RebalanceTimer, "rebalance-interval", 5*time.Minute,
flag.DurationVar(&opt.RebalanceTimer, "rebalance-interval", 0,
"Minimum interval between two container rebalancing attempts. Use 'disable' for disabling.")

flag.BoolVar(&opt.DisableUI, "disable-ui", false,
Expand Down

0 comments on commit 215f1f4

Please sign in to comment.