@@ -27,7 +27,7 @@ import (
2727)
2828
2929// 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 ) {
3131 oldContextFunc := controllerapp .CreateControllerContext
3232 return func (s * controlleroptions.CMServer , rootClientBuilder , clientBuilder controller.ControllerClientBuilder , stop <- chan struct {}) (controllerapp.ControllerContext , error ) {
3333 ret , err := oldContextFunc (s , rootClientBuilder , clientBuilder , stop )
@@ -38,6 +38,7 @@ func newKubeControllerContext(informers *informers) func(s *controlleroptions.CM
3838 // Overwrite the informers. Since nothing accessed the existing informers that we're overwriting, they are inert.
3939 // TODO Remove this. It keeps in-process memory utilization down, but we shouldn't do it.
4040 ret .InformerFactory = newGenericInformers (informers )
41+ ret .InformersStarted = informersStarted
4142
4243 return ret , nil
4344 }
@@ -219,10 +220,11 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
219220}
220221
221222func 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 )
224225 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 )
226228 }
227229
228230 // TODO we need a real identity for this. Right now it's just using the loopback connection like it used to.
0 commit comments