Skip to content

Commit

Permalink
Bug 1508061: Fix panic when accessing controller args
Browse files Browse the repository at this point in the history
  • Loading branch information
mfojtik committed Nov 1, 2017
1 parent eec9d69 commit 9b2f23d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions pkg/cmd/server/start/start_kube_controller_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ func kubeControllerManagerAddFlags(cmserver *controlleroptions.CMServer) func(fl
}
}

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

Expand Down
8 changes: 5 additions & 3 deletions pkg/cmd/server/start/start_kube_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
cmdflags "github.com/openshift/origin/pkg/cmd/util/flags"
)

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

0 comments on commit 9b2f23d

Please sign in to comment.