Move PredicateChecker initialization before processors initialization
This commit is contained in:
parent
43a8c00146
commit
62c68e1280
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue