@@ -27,7 +27,7 @@ import (
27
27
)
28
28
29
29
// newKubeControllerContext provides a function which overrides the default and plugs a different set of informers in
30
- func newKubeControllerContext (informers * informers ) func (s * controlleroptions.CMServer , rootClientBuilder , clientBuilder controller.ControllerClientBuilder , stop <- chan struct {}) (controllerapp.ControllerContext , error ) {
30
+ func newKubeControllerContext (informers * informers , informersStarted chan struct {} ) func (s * controlleroptions.CMServer , rootClientBuilder , clientBuilder controller.ControllerClientBuilder , stop <- chan struct {}) (controllerapp.ControllerContext , error ) {
31
31
oldContextFunc := controllerapp .CreateControllerContext
32
32
return func (s * controlleroptions.CMServer , rootClientBuilder , clientBuilder controller.ControllerClientBuilder , stop <- chan struct {}) (controllerapp.ControllerContext , error ) {
33
33
ret , err := oldContextFunc (s , rootClientBuilder , clientBuilder , stop )
@@ -38,6 +38,7 @@ func newKubeControllerContext(informers *informers) func(s *controlleroptions.CM
38
38
// Overwrite the informers. Since nothing accessed the existing informers that we're overwriting, they are inert.
39
39
// TODO Remove this. It keeps in-process memory utilization down, but we shouldn't do it.
40
40
ret .InformerFactory = newGenericInformers (informers )
41
+ ret .InformersStarted = informersStarted
41
42
42
43
return ret , nil
43
44
}
@@ -219,10 +220,11 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
219
220
}
220
221
221
222
func runEmbeddedKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout string , dynamicProvisioningEnabled bool , cmdLineArgs map [string ][]string ,
222
- recyclerImage string , informers * informers ) {
223
- controllerapp .CreateControllerContext = newKubeControllerContext (informers )
223
+ recyclerImage string , informers * informers , informersStarted chan struct {}, kubeControllersStarted chan struct {} ) {
224
+ controllerapp .CreateControllerContext = newKubeControllerContext (informers , informersStarted )
224
225
controllerapp .StartInformers = func (stop <- chan struct {}) {
225
- informers .Start (stop )
226
+ // We'll start everything out of band, BUT we don't want to start until kube has called this
227
+ close (kubeControllersStarted )
226
228
}
227
229
228
230
// TODO we need a real identity for this. Right now it's just using the loopback connection like it used to.
0 commit comments