remove unnecessary nil check for cloud

pull/564/head
maohongbin01 2019-01-25 23:26:40 +08:00
parent d654b49c0e
commit ac8f0c81e5
1 changed files with 5 additions and 7 deletions

View File

@ -212,13 +212,11 @@ func Run(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}) error
// startControllers starts the cloud specific controller loops. // startControllers starts the cloud specific controller loops.
func startControllers(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}, cloud cloudprovider.Interface, controllers map[string]initFunc) error { func startControllers(c *cloudcontrollerconfig.CompletedConfig, stopCh <-chan struct{}, cloud cloudprovider.Interface, controllers map[string]initFunc) error {
if cloud != nil { // Initialize the cloud provider with a reference to the clientBuilder
// Initialize the cloud provider with a reference to the clientBuilder cloud.Initialize(c.ClientBuilder, stopCh)
cloud.Initialize(c.ClientBuilder, stopCh) // Set the informer on the user cloud object
// Set the informer on the user cloud object if informerUserCloud, ok := cloud.(cloudprovider.InformerUser); ok {
if informerUserCloud, ok := cloud.(cloudprovider.InformerUser); ok { informerUserCloud.SetInformers(c.SharedInformers)
informerUserCloud.SetInformers(c.SharedInformers)
}
} }
for controllerName, initFn := range controllers { for controllerName, initFn := range controllers {