@@ -16,7 +16,6 @@ import (
16
16
controllerapp "k8s.io/kubernetes/cmd/kube-controller-manager/app"
17
17
controlleroptions "k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
18
18
"k8s.io/kubernetes/pkg/api/legacyscheme"
19
- "k8s.io/kubernetes/pkg/controller"
20
19
"k8s.io/kubernetes/pkg/volume"
21
20
_ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider"
22
21
@@ -25,26 +24,6 @@ import (
25
24
"k8s.io/kubernetes/pkg/apis/componentconfig"
26
25
)
27
26
28
- // newKubeControllerContext provides a function which overrides the default and plugs a different set of informers in
29
- func newKubeControllerContext (informers * informers ) func (s * controlleroptions.CMServer , rootClientBuilder , clientBuilder controller.ControllerClientBuilder , stop <- chan struct {}) (controllerapp.ControllerContext , error ) {
30
- oldContextFunc := controllerapp .CreateControllerContext
31
- return func (s * controlleroptions.CMServer , rootClientBuilder , clientBuilder controller.ControllerClientBuilder , stop <- chan struct {}) (controllerapp.ControllerContext , error ) {
32
- ret , err := oldContextFunc (s , rootClientBuilder , clientBuilder , stop )
33
- if err != nil {
34
- return controllerapp.ControllerContext {}, err
35
- }
36
-
37
- // Overwrite the informers, because we have our custom generic informers for quota.
38
- // TODO update quota to create its own informer like garbage collection or if we split this out, actually add our external types to the kube generic informer
39
- ret .InformerFactory = externalKubeInformersWithExtraGenerics {
40
- SharedInformerFactory : informers .GetExternalKubeInformers (),
41
- genericResourceInformer : informers .ToGenericInformer (),
42
- }
43
-
44
- return ret , nil
45
- }
46
- }
47
-
48
27
func kubeControllerManagerAddFlags (cmserver * controlleroptions.CMServer ) func (flags * pflag.FlagSet ) {
49
28
return func (flags * pflag.FlagSet ) {
50
29
cmserver .AddFlags (flags , controllerapp .KnownControllers (), controllerapp .ControllersDisabledByDefault .List ())
@@ -225,7 +204,13 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
225
204
226
205
func runEmbeddedKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout string , dynamicProvisioningEnabled bool , cmdLineArgs map [string ][]string ,
227
206
recyclerImage string , informers * informers ) {
228
- controllerapp .CreateControllerContext = newKubeControllerContext (informers )
207
+
208
+ // Overwrite the informers, because we have our custom generic informers for quota.
209
+ // TODO update quota to create its own informer like garbage collection or if we split this out, actually add our external types to the kube generic informer
210
+ controllerapp .InformerFactoryOverride = externalKubeInformersWithExtraGenerics {
211
+ SharedInformerFactory : informers .GetExternalKubeInformers (),
212
+ genericResourceInformer : informers .ToGenericInformer (),
213
+ }
229
214
230
215
// TODO we need a real identity for this. Right now it's just using the loopback connection like it used to.
231
216
controllerManager , cleanupFunctions , err := newKubeControllerManager (kubeconfigFile , saPrivateKeyFile , saRootCAFile , podEvictionTimeout , recyclerImage , dynamicProvisioningEnabled , cmdLineArgs )
0 commit comments