Skip to content

Commit

Permalink
Add staggering on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckal777 committed Sep 3, 2021
1 parent 951427a commit 4ce8b4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions esx/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Config struct {
Period time.Duration
Timeout time.Duration
} `config:"podDeletion" validate:"required"`
Stagger time.Duration `config:"stagger"`
} `config:"intervals" validate:"required"`
VCenters VCenters `config:"vCenters" validate:"required"`
}
Expand Down
2 changes: 2 additions & 0 deletions esx/runnable.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package esx
import (
"context"
"fmt"
"time"

"github.com/elastic/go-ucfg/yaml"
"github.com/go-logr/logr"
Expand Down Expand Up @@ -160,6 +161,7 @@ func (r *Runnable) ShutdownNodes(ctx context.Context, vCenters *VCenters, esx *H
r.Log.Error(err, "Failed to drain node.", "node", node.Name)
continue
}
time.Sleep(conf.Intervals.Stagger)
r.Log.Info("Going to shutdown VM.", "node", node.Name)
err = ensureVmOff(ctx, vCenters, esx.HostInfo, node.Name)
if err != nil {
Expand Down

0 comments on commit 4ce8b4c

Please sign in to comment.