Skip to content

Commit 302b11f

Browse files
Merge pull request #18097 from deads2k/controller-18-patch-again
Automatic merge from submit-queue (batch tested with PRs 18040, 18097, 18098, 18106, 18087). patch controllers for storage fixes https://bugzilla.redhat.com/show_bug.cgi?id=1531444 /assign @jsafrane @jsafrane please confirm this fixes your problem. @mfojtik
2 parents 0934913 + 33febce commit 302b11f

File tree

3 files changed

+16
-33
lines changed

3 files changed

+16
-33
lines changed

pkg/cmd/server/start/start_kube_controller_manager.go

+7-22
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
controllerapp "k8s.io/kubernetes/cmd/kube-controller-manager/app"
1717
controlleroptions "k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
1818
"k8s.io/kubernetes/pkg/api/legacyscheme"
19-
"k8s.io/kubernetes/pkg/controller"
2019
"k8s.io/kubernetes/pkg/volume"
2120
_ "k8s.io/kubernetes/plugin/pkg/scheduler/algorithmprovider"
2221

@@ -25,26 +24,6 @@ import (
2524
"k8s.io/kubernetes/pkg/apis/componentconfig"
2625
)
2726

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-
4827
func kubeControllerManagerAddFlags(cmserver *controlleroptions.CMServer) func(flags *pflag.FlagSet) {
4928
return func(flags *pflag.FlagSet) {
5029
cmserver.AddFlags(flags, controllerapp.KnownControllers(), controllerapp.ControllersDisabledByDefault.List())
@@ -225,7 +204,13 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
225204

226205
func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCAFile, podEvictionTimeout string, dynamicProvisioningEnabled bool, cmdLineArgs map[string][]string,
227206
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+
}
229214

230215
// TODO we need a real identity for this. Right now it's just using the loopback connection like it used to.
231216
controllerManager, cleanupFunctions, err := newKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCAFile, podEvictionTimeout, recyclerImage, dynamicProvisioningEnabled, cmdLineArgs)

vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/controllermanager.go

+7-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/k8s.io/kubernetes/cmd/kube-controller-manager/app/patch.go

+2-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)