@@ -216,15 +216,7 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
216
216
return filename , nil
217
217
}
218
218
219
- func runEmbeddedKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout string , dynamicProvisioningEnabled bool , cmdLineArgs map [string ][]string ,
220
- recyclerImage string , informers * informers ) {
221
- controllerapp .CreateControllerContext = newKubeControllerContext (informers )
222
- controllerapp .StartInformers = func (stop <- chan struct {}) {
223
- informers .Start (stop )
224
- }
225
-
226
- // TODO we need a real identity for this. Right now it's just using the loopback connection like it used to.
227
- controllerManager , cleanupFunctions , err := newKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout , recyclerImage , dynamicProvisioningEnabled , cmdLineArgs )
219
+ func runEmbeddedKubeControllerManager (controllerManager * controlleroptions.CMServer , cleanupFunctions []func ()) {
228
220
defer func () {
229
221
// Clean up any temporary files and similar stuff.
230
222
// TODO: Make sure this defer is actually called - controllerapp.Run()
@@ -233,17 +225,27 @@ func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCA
233
225
f ()
234
226
}
235
227
}()
236
-
237
- if err != nil {
238
- glog .Fatal (err )
239
- }
240
228
// this does a second leader election, but doing the second leader election will allow us to move out process in
241
229
// 3.8 if we so choose.
242
230
if err := controllerapp .Run (controllerManager ); err != nil {
243
231
glog .Fatal (err )
244
232
}
245
233
}
246
234
235
+ func setupEmbeddedKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout string , dynamicProvisioningEnabled bool , cmdLineArgs map [string ][]string ,
236
+ recyclerImage string , informers * informers ) (* controlleroptions.CMServer , []func ()) {
237
+ controllerapp .CreateControllerContext = newKubeControllerContext (informers )
238
+ controllerapp .StartInformers = func (stop <- chan struct {}) {
239
+ informers .Start (stop )
240
+ }
241
+ // TODO we need a real identity for this. Right now it's just using the loopback connection like it used to.
242
+ controllerManager , cleanupFunctions , err := newKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout , recyclerImage , dynamicProvisioningEnabled , cmdLineArgs )
243
+ if err != nil {
244
+ glog .Fatal (err )
245
+ }
246
+ return controllerManager , cleanupFunctions
247
+ }
248
+
247
249
type GenericResourceInformer interface {
248
250
ForResource (resource schema.GroupVersionResource ) (kinformers.GenericInformer , error )
249
251
}
0 commit comments