@@ -32,6 +32,7 @@ import (
32
32
clientsetbeta1 "github.com/koordinator-sh/koordinator/pkg/client/clientset/versioned"
33
33
"github.com/koordinator-sh/koordinator/pkg/client/clientset/versioned/typed/scheduling/v1alpha1"
34
34
"github.com/koordinator-sh/koordinator/pkg/koordlet/config"
35
+ "github.com/koordinator-sh/koordinator/pkg/koordlet/extension"
35
36
"github.com/koordinator-sh/koordinator/pkg/koordlet/metriccache"
36
37
"github.com/koordinator-sh/koordinator/pkg/koordlet/metrics"
37
38
"github.com/koordinator-sh/koordinator/pkg/koordlet/metricsadvisor"
@@ -47,6 +48,8 @@ import (
47
48
48
49
var (
49
50
scheme = apiruntime .NewScheme ()
51
+
52
+ extensionControllerInitFuncs = map [string ]extension.ControllerInitFunc {}
50
53
)
51
54
52
55
func init () {
@@ -65,6 +68,8 @@ type daemon struct {
65
68
runtimeHook runtimehooks.RuntimeHook
66
69
predictServer prediction.PredictServer
67
70
executor resourceexecutor.ResourceUpdateExecutor
71
+
72
+ extensionControllers []extension.Controller
68
73
}
69
74
70
75
func NewDaemon (config * config.Configuration ) (Daemon , error ) {
@@ -111,6 +116,11 @@ func NewDaemon(config *config.Configuration) (Daemon, error) {
111
116
return nil , err
112
117
}
113
118
119
+ extensionControllers := []extension.Controller {}
120
+ for _ , initFunc := range extensionControllerInitFuncs {
121
+ extensionControllers = append (extensionControllers , initFunc (nodeName , kubeClient , statesInformer ))
122
+ }
123
+
114
124
d := & daemon {
115
125
metricAdvisor : collectorService ,
116
126
statesInformer : statesInformer ,
@@ -119,6 +129,8 @@ func NewDaemon(config *config.Configuration) (Daemon, error) {
119
129
runtimeHook : runtimeHook ,
120
130
predictServer : predictServer ,
121
131
executor : resourceexecutor .NewResourceUpdateExecutor (),
132
+
133
+ extensionControllers : extensionControllers ,
122
134
}
123
135
124
136
return d , nil
@@ -182,6 +194,16 @@ func (d *daemon) Run(stopCh <-chan struct{}) {
182
194
}
183
195
}()
184
196
197
+ for _ , c := range d .extensionControllers {
198
+ go func (controller extension.Controller ) {
199
+ name := controller .Name ()
200
+ klog .Infof ("starting extension controller %v" , name )
201
+ if err := controller .Run (stopCh ); err != nil {
202
+ klog .Fatalf ("Unable to start the extension controller %v, err: %v" , name , err )
203
+ }
204
+ }(c )
205
+ }
206
+
185
207
klog .Info ("Start daemon successfully" )
186
208
<- stopCh
187
209
klog .Info ("Shutting down daemon" )
0 commit comments