Skip to content

Commit

Permalink
Bug 1508061: Fix panic during openshift controller options initializa…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
mfojtik committed Nov 1, 2017
1 parent 8fc2fe6 commit a29cfa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cmd/server/start/start_kube_controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func createRecylerTemplate(recyclerImage string) (string, error) {
}

func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCAFile, podEvictionTimeout string, dynamicProvisioningEnabled bool, cmdLineArgs map[string][]string,
recyclerImage string, informers *informers) {
initialized <-chan struct{}, recyclerImage string, informers *informers) {
controllerapp.CreateControllerContext = newKubeControllerContext(informers)
controllerapp.StartInformers = func(stop <-chan struct{}) {
informers.Start(stop)
Expand All @@ -233,6 +233,9 @@ func runEmbeddedKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCA
f()
}
}()
// At this point do not mutate cmdLineArgs and signal this back to upper
// level.
close(initialized)

if err != nil {
glog.Fatal(err)
Expand Down
7 changes: 7 additions & 0 deletions pkg/cmd/server/start/start_master.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,16 +475,23 @@ func (m *Master) Start() error {
// continuously run the scheduler while we have the primary lease
go runEmbeddedScheduler(m.config.MasterClients.OpenShiftLoopbackKubeConfig, m.config.KubernetesMasterConfig.SchedulerConfigFile, m.config.KubernetesMasterConfig.SchedulerArguments)

controllerArgumentsInitialized := make(chan struct{})

go runEmbeddedKubeControllerManager(
m.config.MasterClients.OpenShiftLoopbackKubeConfig,
m.config.ServiceAccountConfig.PrivateKeyFile,
m.config.ServiceAccountConfig.MasterCA,
m.config.KubernetesMasterConfig.PodEvictionTimeout,
m.config.VolumeConfig.DynamicProvisioningEnabled,
m.config.KubernetesMasterConfig.ControllerArguments,
controllerArgumentsInitialized,
recyclerImage,
informers)

// Wait for the runEmbeddedKubeControllerManager to mutate the
// ControllerArguments to prevent getOpenshiftControllerOptions from
// panicking because of concurrent read/write access.
<-controllerArgumentsInitialized
openshiftControllerOptions, err := getOpenshiftControllerOptions(m.config.KubernetesMasterConfig.ControllerArguments)
if err != nil {
glog.Fatal(err)
Expand Down

0 comments on commit a29cfa5

Please sign in to comment.