// startControllers starts the cloud specific controller loops. funcstartControllers(c *cloudcontrollerconfig.CompletedConfig, stop <-chanstruct{}, cloud cloudprovider.Interface)error { ... if cloud != nil { // Initialize the cloud provider with a reference to the clientBuilder cloud.Initialize(c.ClientBuilder) } // Start the CloudNodeController nodeController := cloudcontrollers.NewCloudNodeController( c.SharedInformers.Core().V1().Nodes(), client("cloud-node-controller"), cloud, c.ComponentConfig.KubeCloudShared.NodeMonitorPeriod.Duration, c.ComponentConfig.NodeStatusUpdateFrequency.Duration)
nodeController.Run(stop) ... // Start the PersistentVolumeLabelController pvlController := cloudcontrollers.NewPersistentVolumeLabelController(client("pvl-controller"), cloud) go pvlController.Run(5, stop) ... // Start the service controller serviceController, err := servicecontroller.New( cloud, client("service-controller"), c.SharedInformers.Core().V1().Services(), c.SharedInformers.Core().V1().Nodes(), c.ComponentConfig.KubeCloudShared.ClusterName, ) if err != nil { glog.Errorf("Failed to start service controller: %v", err) } else { go serviceController.Run(stop, int(c.ComponentConfig.ServiceController.ConcurrentServiceSyncs)) ...
// If CIDRs should be allocated for pods and set on the CloudProvider, then start the route controller if c.ComponentConfig.KubeCloudShared.AllocateNodeCIDRs && c.ComponentConfig.KubeCloudShared.ConfigureCloudRoutes { if routes, ok := cloud.Routes(); !ok { glog.Warning("configure-cloud-routes is set, but cloud provider does not support routes. Will not configure cloud provider routes.") } else { var clusterCIDR *net.IPNet iflen(strings.TrimSpace(c.ComponentConfig.KubeCloudShared.ClusterCIDR)) != 0 { _, clusterCIDR, err = net.ParseCIDR(c.ComponentConfig.KubeCloudShared.ClusterCIDR) if err != nil { glog.Warningf("Unsuccessful parsing of cluster CIDR %v: %v", c.ComponentConfig.KubeCloudShared.ClusterCIDR, err) } }