Skip to content

Commit 36e4f29

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

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/cmd/server/start/start_kube_controller_manager.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,15 @@ 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+
newVal := []string{}
57+
for _, item := range v {
58+
newVal = append(newVal, item)
59+
}
60+
cmdLineArgs[k] = newVal
5561
}
5662
cleanupFunctions := []func(){}
5763

0 commit comments

Comments
 (0)