Merge pull request #43736 from NickrenREN/cm-extrac

Automatic merge from submit-queue (batch tested with PRs 43870, 30302, 42722, 43736)

Extract ParseCIDR and modify attachDetachControllerName

**Release note**:

```release-note
NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-04-10 13:33:19 -07:00 committed by GitHub
commit dda64fd13b

View File

@ -280,7 +280,7 @@ func KnownControllers() []string {
serviceControllerName, serviceControllerName,
routeControllerName, routeControllerName,
pvBinderControllerName, pvBinderControllerName,
attachDetatchControllerName, attachDetachControllerName,
) )
// add "special" controllers that aren't initialized normally // add "special" controllers that aren't initialized normally
@ -365,12 +365,12 @@ func getAvailableResources(clientBuilder controller.ControllerClientBuilder) (ma
} }
const ( const (
saTokenControllerName = "serviceaccount-token" saTokenControllerName = "serviceaccount-token"
nodeControllerName = "node" nodeControllerName = "node"
serviceControllerName = "service" serviceControllerName = "service"
routeControllerName = "route" routeControllerName = "route"
pvBinderControllerName = "persistentvolume-binder" pvBinderControllerName = "persistentvolume-binder"
attachDetatchControllerName = "attachdetach" attachDetachControllerName = "attachdetach"
) )
func StartControllers(controllers map[string]InitFunc, s *options.CMServer, rootClientBuilder, clientBuilder controller.ControllerClientBuilder, stop <-chan struct{}) error { func StartControllers(controllers map[string]InitFunc, s *options.CMServer, rootClientBuilder, clientBuilder controller.ControllerClientBuilder, stop <-chan struct{}) error {
@ -444,7 +444,7 @@ func StartControllers(controllers map[string]InitFunc, s *options.CMServer, root
glog.Infof("Started %q", controllerName) glog.Infof("Started %q", controllerName)
} }
// all the remaning plugins want this cloud variable // all the remaining plugins want this cloud variable
cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile) cloud, err := cloudprovider.InitCloudProvider(s.CloudProvider, s.CloudConfigFile)
if err != nil { if err != nil {
return fmt.Errorf("cloud provider could not be initialized: %v", err) return fmt.Errorf("cloud provider could not be initialized: %v", err)
@ -553,7 +553,7 @@ func StartControllers(controllers map[string]InitFunc, s *options.CMServer, root
glog.Warningf("%q is disabled", pvBinderControllerName) glog.Warningf("%q is disabled", pvBinderControllerName)
} }
if ctx.IsControllerEnabled(attachDetatchControllerName) { if ctx.IsControllerEnabled(attachDetachControllerName) {
if s.ReconcilerSyncLoopPeriod.Duration < time.Second { if s.ReconcilerSyncLoopPeriod.Duration < time.Second {
return fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period.") return fmt.Errorf("Duration time must be greater than one second as set via command line option reconcile-sync-loop-period.")
} }
@ -575,7 +575,7 @@ func StartControllers(controllers map[string]InitFunc, s *options.CMServer, root
go attachDetachController.Run(stop) go attachDetachController.Run(stop)
time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter)) time.Sleep(wait.Jitter(s.ControllerStartInterval.Duration, ControllerStartJitter))
} else { } else {
glog.Warningf("%q is disabled", attachDetatchControllerName) glog.Warningf("%q is disabled", attachDetachControllerName)
} }
sharedInformers.Start(stop) sharedInformers.Start(stop)