Skip to content

Commit 4103407

Browse files
authored
Merge pull request #6210 from artemvmin/set-drainability-rules
Initialize default drainability rules
2 parents a3a29cf + ab4c5cb commit 4103407

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cluster-autoscaler/core/autoscaler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ func initializeDefaultOptions(opts *AutoscalerOptions) error {
144144
opts.Backoff =
145145
backoff.NewIdBasedExponentialBackoff(opts.InitialNodeGroupBackoffDuration, opts.MaxNodeGroupBackoffDuration, opts.NodeGroupBackoffResetTimeout)
146146
}
147+
if opts.DrainabilityRules == nil {
148+
opts.DrainabilityRules = rules.Default(opts.DeleteOptions)
149+
}
147150

148151
return nil
149152
}

cluster-autoscaler/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,7 @@ func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter
462462
return nil, err
463463
}
464464
deleteOptions := options.NewNodeDeleteOptions(autoscalingOptions)
465+
drainabilityRules := rules.Default(deleteOptions)
465466

466467
opts := core.AutoscalerOptions{
467468
AutoscalingOptions: autoscalingOptions,
@@ -472,6 +473,7 @@ func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter
472473
DebuggingSnapshotter: debuggingSnapshotter,
473474
PredicateChecker: predicateChecker,
474475
DeleteOptions: deleteOptions,
476+
DrainabilityRules: drainabilityRules,
475477
}
476478

477479
opts.Processors = ca_processors.DefaultProcessors(autoscalingOptions)
@@ -481,7 +483,7 @@ func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter
481483
if autoscalingOptions.ParallelDrain {
482484
sdCandidatesSorting := previouscandidates.NewPreviousCandidates()
483485
scaleDownCandidatesComparers = []scaledowncandidates.CandidatesComparer{
484-
emptycandidates.NewEmptySortingProcessor(emptycandidates.NewNodeInfoGetter(opts.ClusterSnapshot), deleteOptions, rules.Default(deleteOptions)),
486+
emptycandidates.NewEmptySortingProcessor(emptycandidates.NewNodeInfoGetter(opts.ClusterSnapshot), deleteOptions, drainabilityRules),
485487
sdCandidatesSorting,
486488
}
487489
opts.Processors.ScaleDownCandidatesNotifier.Register(sdCandidatesSorting)

0 commit comments

Comments
 (0)