Skip to content

Commit 8c7ba88

Browse files
committed
Bug 1508061: Fix panic when accessing controller args
1 parent eec9d69 commit 8c7ba88

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
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

0 commit comments

Comments
 (0)