Skip to content

Commit 103ed86

Browse files
committed
run openshift and kube controllers on different leases
1 parent 2748756 commit 103ed86

File tree

2 files changed

+23
-26
lines changed

2 files changed

+23
-26
lines changed

pkg/cmd/server/start/start_kube_controller_manager.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func newKubeControllerContext(informers *informers) func(s *controlleroptions.CM
3535
return controllerapp.ControllerContext{}, err
3636
}
3737

38-
// Overwrite the informers. Since nothing accessed the existing informers that we're overwriting, they are inert.
39-
// TODO Remove this. It keeps in-process memory utilization down, but we shouldn't do it.
38+
// Overwrite the informers, because we have our custom generic informers for quota.
39+
// 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
4040
ret.InformerFactory = newGenericInformers(informers)
4141

4242
return ret, nil
@@ -224,9 +224,6 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
224224
func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCAFile, podEvictionTimeout string, dynamicProvisioningEnabled bool, cmdLineArgs map[string][]string,
225225
recyclerImage string, informers *informers) {
226226
controllerapp.CreateControllerContext = newKubeControllerContext(informers)
227-
controllerapp.StartInformers = func(stop <-chan struct{}) {
228-
informers.Start(stop)
229-
}
230227

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

pkg/cmd/server/start/start_master.go

+21-21
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,6 @@ func (m *Master) Start() error {
391391
if err != nil {
392392
return err
393393
}
394-
kubeControllerInformers, err := NewInformers(*m.config)
395-
if err != nil {
396-
return err
397-
}
398394

399395
_, config, err := configapi.GetExternalKubeClient(m.config.MasterClients.OpenShiftLoopbackKubeConfig, m.config.MasterClients.OpenShiftLoopbackClientConnectionOverrides)
400396
if err != nil {
@@ -470,38 +466,42 @@ func (m *Master) Start() error {
470466
glog.Fatalf("Controller graceful shutdown requested")
471467
}()
472468

469+
go runEmbeddedScheduler(m.config.MasterClients.OpenShiftLoopbackKubeConfig, m.config.KubernetesMasterConfig.SchedulerConfigFile, m.config.KubernetesMasterConfig.SchedulerArguments)
470+
471+
kubeControllerInformers, err := NewInformers(*m.config)
472+
if err != nil {
473+
return err
474+
}
475+
go runEmbeddedKubeControllerManager(
476+
m.config.MasterClients.OpenShiftLoopbackKubeConfig,
477+
m.config.ServiceAccountConfig.PrivateKeyFile,
478+
m.config.ServiceAccountConfig.MasterCA,
479+
m.config.KubernetesMasterConfig.PodEvictionTimeout,
480+
m.config.VolumeConfig.DynamicProvisioningEnabled,
481+
m.config.KubernetesMasterConfig.ControllerArguments,
482+
recyclerImage,
483+
kubeControllerInformers)
484+
473485
go func() {
474486
controllerPlug.WaitForStart()
475487
if err := waitForHealthyAPIServer(kubeExternal.Discovery().RESTClient()); err != nil {
476488
glog.Fatal(err)
477489
}
478490

479-
// continuously run the scheduler while we have the primary lease
480-
go runEmbeddedScheduler(m.config.MasterClients.OpenShiftLoopbackKubeConfig, m.config.KubernetesMasterConfig.SchedulerConfigFile, m.config.KubernetesMasterConfig.SchedulerArguments)
481-
482-
go runEmbeddedKubeControllerManager(
483-
m.config.MasterClients.OpenShiftLoopbackKubeConfig,
484-
m.config.ServiceAccountConfig.PrivateKeyFile,
485-
m.config.ServiceAccountConfig.MasterCA,
486-
m.config.KubernetesMasterConfig.PodEvictionTimeout,
487-
m.config.VolumeConfig.DynamicProvisioningEnabled,
488-
m.config.KubernetesMasterConfig.ControllerArguments,
489-
recyclerImage,
490-
kubeControllerInformers)
491-
492491
openshiftControllerOptions, err := getOpenshiftControllerOptions(m.config.KubernetesMasterConfig.ControllerArguments)
493492
if err != nil {
494493
glog.Fatal(err)
495494
}
496495

497-
controllerContext := newControllerContext(openshiftControllerOptions, privilegedLoopbackConfig, kubeExternal, openshiftControllerInformers, utilwait.NeverStop, make(chan struct{}))
496+
stopCh := utilwait.NeverStop
497+
informersStarted := make(chan struct{})
498+
controllerContext := newControllerContext(openshiftControllerOptions, privilegedLoopbackConfig, kubeExternal, openshiftControllerInformers, stopCh, informersStarted)
498499
if err := startControllers(*m.config, allocationController, controllerContext); err != nil {
499500
glog.Fatal(err)
500501
}
501502

502-
openshiftControllerInformers.Start(utilwait.NeverStop)
503-
close(controllerContext.InformersStarted)
504-
503+
openshiftControllerInformers.Start(stopCh)
504+
close(informersStarted)
505505
}()
506506
}
507507

0 commit comments

Comments
 (0)