Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: only reconciling routes in cloud controller manager #671

Merged
merged 1 commit into from
Jun 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 12 additions & 11 deletions pkg/provider/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ func init() {
}

// NewCloud returns a Cloud with initialized clients
func NewCloud(configReader io.Reader, syncZones bool) (cloudprovider.Interface, error) {
az, err := NewCloudWithoutFeatureGates(configReader, syncZones)
func NewCloud(configReader io.Reader, callFromCCM bool) (cloudprovider.Interface, error) {
az, err := NewCloudWithoutFeatureGates(configReader, callFromCCM)
if err != nil {
return nil, err
}
Expand All @@ -340,7 +340,7 @@ func NewCloud(configReader io.Reader, syncZones bool) (cloudprovider.Interface,
return az, nil
}

func NewCloudFromConfigFile(configFilePath string, syncZones bool) (cloudprovider.Interface, error) {
func NewCloudFromConfigFile(configFilePath string, calFromCCM bool) (cloudprovider.Interface, error) {
var (
cloud cloudprovider.Interface
err error
Expand All @@ -355,7 +355,7 @@ func NewCloudFromConfigFile(configFilePath string, syncZones bool) (cloudprovide
}

defer config.Close()
cloud, err = NewCloud(config, syncZones)
cloud, err = NewCloud(config, calFromCCM)
} else {
// Pass explicit nil so plugins can actually check for nil. See
// "Why is my nil error value not equal to nil?" in golang.org/doc/faq.
Expand Down Expand Up @@ -415,7 +415,7 @@ func NewCloudFromSecret(clientBuilder cloudprovider.ControllerClientBuilder, sec

// NewCloudWithoutFeatureGates returns a Cloud without trying to wire the feature gates. This is used by the unit tests
// that don't load the actual features being used in the cluster.
func NewCloudWithoutFeatureGates(configReader io.Reader, syncZones bool) (*Cloud, error) {
func NewCloudWithoutFeatureGates(configReader io.Reader, callFromCCM bool) (*Cloud, error) {
config, err := parseConfig(configReader)
if err != nil {
return nil, err
Expand All @@ -429,7 +429,7 @@ func NewCloudWithoutFeatureGates(configReader io.Reader, syncZones bool) (*Cloud
routeCIDRs: map[string]string{},
}

err = az.InitializeCloudFromConfig(config, false, syncZones)
err = az.InitializeCloudFromConfig(config, false, callFromCCM)
if err != nil {
return nil, err
}
Expand All @@ -438,7 +438,7 @@ func NewCloudWithoutFeatureGates(configReader io.Reader, syncZones bool) (*Cloud
}

// InitializeCloudFromConfig initializes the Cloud from config.
func (az *Cloud) InitializeCloudFromConfig(config *Config, fromSecret, syncZones bool) error {
func (az *Cloud) InitializeCloudFromConfig(config *Config, fromSecret, callFromCCM bool) error {
if config == nil {
// should not reach here
return fmt.Errorf("InitializeCloudFromConfig: cannot initialize from nil config")
Expand Down Expand Up @@ -559,11 +559,12 @@ func (az *Cloud) InitializeCloudFromConfig(config *Config, fromSecret, syncZones
return err
}

// start delayed route updater.
az.routeUpdater = newDelayedRouteUpdater(az, routeUpdateInterval)
go az.routeUpdater.run()
// updating routes and syncing zones only in CCM
if callFromCCM {
// start delayed route updater.
az.routeUpdater = newDelayedRouteUpdater(az, routeUpdateInterval)
go az.routeUpdater.run()

if syncZones {
// wait for the success first time of syncing zones
err = az.syncRegionZonesMap()
if err != nil {
Expand Down