diff --git a/cluster-autoscaler/core/autoscaler.go b/cluster-autoscaler/core/autoscaler.go index 523642b1018b..f6084ec46ad1 100644 --- a/cluster-autoscaler/core/autoscaler.go +++ b/cluster-autoscaler/core/autoscaler.go @@ -90,14 +90,6 @@ func initializeDefaultOptions(opts *AutoscalerOptions) error { if opts.AutoscalingKubeClients == nil { opts.AutoscalingKubeClients = context.NewAutoscalingKubeClients(opts.AutoscalingOptions, opts.KubeClient, opts.EventsKubeClient) } - if opts.PredicateChecker == nil { - predicateCheckerStopChannel := make(chan struct{}) - predicateChecker, err := predicatechecker.NewSchedulerBasedPredicateChecker(opts.KubeClient, predicateCheckerStopChannel) - if err != nil { - return err - } - opts.PredicateChecker = predicateChecker - } if opts.ClusterSnapshot == nil { opts.ClusterSnapshot = clustersnapshot.NewBasicClusterSnapshot() } diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 4b749546fcc9..22e1d9460098 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -30,6 +30,7 @@ import ( "time" "k8s.io/autoscaler/cluster-autoscaler/debuggingsnapshot" + "k8s.io/autoscaler/cluster-autoscaler/simulator/predicatechecker" "github.com/spf13/pflag" @@ -365,12 +366,18 @@ func buildAutoscaler(debuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter kubeClient := createKubeClient(getKubeConfig()) eventsKubeClient := createKubeClient(getKubeConfig()) + predicateChecker, err := predicatechecker.NewSchedulerBasedPredicateChecker(kubeClient, make(chan struct{})) + if err != nil { + return nil, err + } + opts := core.AutoscalerOptions{ AutoscalingOptions: autoscalingOptions, ClusterSnapshot: clustersnapshot.NewDeltaClusterSnapshot(), KubeClient: kubeClient, EventsKubeClient: eventsKubeClient, DebuggingSnapshotter: debuggingSnapshotter, + PredicateChecker: predicateChecker, } opts.Processors = ca_processors.DefaultProcessors()