Skip to content

Commit 7968b96

Browse files
Merge pull request #17127 from mfojtik/fix-initialization-panic
Automatic merge from submit-queue. Bug 1508061: Fix panic during openshift controller options initialization Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1508061 Basically `newKubeControllerManager` mutates the cmdLineArgs in parallel to `getOpenshiftControllerOptions` which is trying to read it. @deads2k @sttts PTAL, i consider this 3.7 blocker.
2 parents 6da6c87 + 9b2f23d commit 7968b96

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

pkg/cmd/server/start/start_kube_controller_manager.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ func kubeControllerManagerAddFlags(cmserver *controlleroptions.CMServer) func(fl
4949
}
5050
}
5151

52-
func newKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCAFile, podEvictionTimeout, recyclerImage string, dynamicProvisioningEnabled bool, cmdLineArgs map[string][]string) (*controlleroptions.CMServer, []func(), error) {
53-
if cmdLineArgs == nil {
54-
cmdLineArgs = map[string][]string{}
52+
func newKubeControllerManager(kubeconfigFile, saPrivateKeyFile, saRootCAFile, podEvictionTimeout, recyclerImage string, dynamicProvisioningEnabled bool, controllerArgs map[string][]string) (*controlleroptions.CMServer, []func(), error) {
53+
cmdLineArgs := map[string][]string{}
54+
// deep-copy the input args to avoid mutation conflict.
55+
for k, v := range controllerArgs {
56+
cmdLineArgs[k] = append([]string{}, v...)
5557
}
5658
cleanupFunctions := []func(){}
5759

pkg/cmd/server/start/start_kube_scheduler.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ import (
1111
cmdflags "github.com/openshift/origin/pkg/cmd/util/flags"
1212
)
1313

14-
func newScheduler(kubeconfigFile, schedulerConfigFile string, cmdLineArgs map[string][]string) (*scheduleroptions.SchedulerServer, error) {
15-
if cmdLineArgs == nil {
16-
cmdLineArgs = map[string][]string{}
14+
func newScheduler(kubeconfigFile, schedulerConfigFile string, schedulerArgs map[string][]string) (*scheduleroptions.SchedulerServer, error) {
15+
cmdLineArgs := map[string][]string{}
16+
// deep-copy the input args to avoid mutation conflict.
17+
for k, v := range schedulerArgs {
18+
cmdLineArgs[k] = append([]string{}, v...)
1719
}
1820
if len(cmdLineArgs["kubeconfig"]) == 0 {
1921
cmdLineArgs["kubeconfig"] = []string{kubeconfigFile}

0 commit comments

Comments
 (0)