diff --git a/esx/config.go b/esx/config.go index a99c6c3..c05dd28 100644 --- a/esx/config.go +++ b/esx/config.go @@ -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"` } diff --git a/esx/runnable.go b/esx/runnable.go index a09b1ed..f3119be 100644 --- a/esx/runnable.go +++ b/esx/runnable.go @@ -22,6 +22,7 @@ package esx import ( "context" "fmt" + "time" "github.com/elastic/go-ucfg/yaml" "github.com/go-logr/logr" @@ -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 {