diff --git a/pkg/cmd/server/start/start_kube_controller_manager.go b/pkg/cmd/server/start/start_kube_controller_manager.go index f45e70a1f997..57f00ff8b80a 100644 --- a/pkg/cmd/server/start/start_kube_controller_manager.go +++ b/pkg/cmd/server/start/start_kube_controller_manager.go @@ -49,9 +49,15 @@ 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 { + newVal := []string{} + for _, item := range v { + newVal = append(newVal, item) + } + cmdLineArgs[k] = newVal } cleanupFunctions := []func(){}