@@ -20,53 +20,24 @@ import (
20
20
"strings"
21
21
"time"
22
22
23
- "k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
24
23
cloudBuilder "k8s.io/autoscaler/cluster-autoscaler/cloudprovider/builder"
25
- "k8s.io/autoscaler/cluster-autoscaler/config"
26
24
"k8s.io/autoscaler/cluster-autoscaler/context"
25
+ "k8s.io/autoscaler/cluster-autoscaler/core/options"
27
26
"k8s.io/autoscaler/cluster-autoscaler/core/scaledown/pdb"
28
- "k8s.io/autoscaler/cluster-autoscaler/core/scaleup"
29
- "k8s.io/autoscaler/cluster-autoscaler/debuggingsnapshot"
30
27
"k8s.io/autoscaler/cluster-autoscaler/estimator"
31
- "k8s.io/autoscaler/cluster-autoscaler/expander"
32
28
"k8s.io/autoscaler/cluster-autoscaler/expander/factory"
33
29
"k8s.io/autoscaler/cluster-autoscaler/observers/loopstart"
34
30
ca_processors "k8s.io/autoscaler/cluster-autoscaler/processors"
35
- "k8s.io/autoscaler/cluster-autoscaler/simulator/clustersnapshot"
36
31
"k8s.io/autoscaler/cluster-autoscaler/simulator/clustersnapshot/predicate"
37
32
"k8s.io/autoscaler/cluster-autoscaler/simulator/clustersnapshot/store"
38
33
"k8s.io/autoscaler/cluster-autoscaler/simulator/drainability/rules"
39
34
draprovider "k8s.io/autoscaler/cluster-autoscaler/simulator/dynamicresources/provider"
40
35
"k8s.io/autoscaler/cluster-autoscaler/simulator/framework"
41
- "k8s.io/autoscaler/cluster-autoscaler/simulator/options"
42
36
"k8s.io/autoscaler/cluster-autoscaler/utils/backoff"
43
37
"k8s.io/autoscaler/cluster-autoscaler/utils/errors"
44
38
"k8s.io/client-go/informers"
45
- kube_client "k8s.io/client-go/kubernetes"
46
39
)
47
40
48
- // AutoscalerOptions is the whole set of options for configuring an autoscaler
49
- type AutoscalerOptions struct {
50
- config.AutoscalingOptions
51
- KubeClient kube_client.Interface
52
- InformerFactory informers.SharedInformerFactory
53
- AutoscalingKubeClients * context.AutoscalingKubeClients
54
- CloudProvider cloudprovider.CloudProvider
55
- FrameworkHandle * framework.Handle
56
- ClusterSnapshot clustersnapshot.ClusterSnapshot
57
- ExpanderStrategy expander.Strategy
58
- EstimatorBuilder estimator.EstimatorBuilder
59
- Processors * ca_processors.AutoscalingProcessors
60
- LoopStartNotifier * loopstart.ObserversList
61
- Backoff backoff.Backoff
62
- DebuggingSnapshotter debuggingsnapshot.DebuggingSnapshotter
63
- RemainingPdbTracker pdb.RemainingPdbTracker
64
- ScaleUpOrchestrator scaleup.Orchestrator
65
- DeleteOptions options.NodeDeleteOptions
66
- DrainabilityRules rules.Rules
67
- DraProvider * draprovider.Provider
68
- }
69
-
70
41
// Autoscaler is the main component of CA which scales up/down node groups according to its configuration
71
42
// The configuration can be injected at the creation of an autoscaler
72
43
type Autoscaler interface {
@@ -83,7 +54,7 @@ type Autoscaler interface {
83
54
}
84
55
85
56
// NewAutoscaler creates an autoscaler of an appropriate type according to the parameters
86
- func NewAutoscaler (opts AutoscalerOptions , informerFactory informers.SharedInformerFactory ) (Autoscaler , errors.AutoscalerError ) {
57
+ func NewAutoscaler (opts options. AutoscalerOptions , informerFactory informers.SharedInformerFactory ) (Autoscaler , errors.AutoscalerError ) {
87
58
err := initializeDefaultOptions (& opts , informerFactory )
88
59
if err != nil {
89
60
return nil , errors .ToAutoscalerError (errors .InternalError , err )
@@ -109,7 +80,7 @@ func NewAutoscaler(opts AutoscalerOptions, informerFactory informers.SharedInfor
109
80
}
110
81
111
82
// Initialize default options if not provided.
112
- func initializeDefaultOptions (opts * AutoscalerOptions , informerFactory informers.SharedInformerFactory ) error {
83
+ func initializeDefaultOptions (opts * options. AutoscalerOptions , informerFactory informers.SharedInformerFactory ) error {
113
84
if opts .Processors == nil {
114
85
opts .Processors = ca_processors .DefaultProcessors (opts .AutoscalingOptions )
115
86
}
@@ -133,7 +104,7 @@ func initializeDefaultOptions(opts *AutoscalerOptions, informerFactory informers
133
104
opts .RemainingPdbTracker = pdb .NewBasicRemainingPdbTracker ()
134
105
}
135
106
if opts .CloudProvider == nil {
136
- opts .CloudProvider = cloudBuilder .NewCloudProvider (opts . AutoscalingOptions , informerFactory )
107
+ opts .CloudProvider = cloudBuilder .NewCloudProvider (opts , informerFactory )
137
108
}
138
109
if opts .ExpanderStrategy == nil {
139
110
expanderFactory := factory .NewFactory ()
0 commit comments