Skip to content

Commit

Permalink
Merge pull request #6550 from gandhipr/prachigandhi/azure-manager-retry
Browse files Browse the repository at this point in the history
Add retry for creatingAzureManager in case of throttled requests
  • Loading branch information
k8s-ci-robot authored Apr 17, 2024
2 parents 5f94f2c + 0d5a71e commit 554366f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion cluster-autoscaler/cloudprovider/azure/azure_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ import (
"time"

"github.com/Azure/go-autorest/autorest/azure"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/autoscaler/cluster-autoscaler/cloudprovider"
"k8s.io/autoscaler/cluster-autoscaler/config"
"k8s.io/autoscaler/cluster-autoscaler/config/dynamic"
kretry "k8s.io/client-go/util/retry"
klog "k8s.io/klog/v2"
"sigs.k8s.io/cloud-provider-azure/pkg/retry"
)

const (
Expand Down Expand Up @@ -106,7 +109,18 @@ func createAzureManagerInternal(configReader io.Reader, discoveryOpts cloudprovi
return nil, err
}

if err := manager.forceRefresh(); err != nil {
retryBackoff := wait.Backoff{
Duration: 2 * time.Minute,
Factor: 1.0,
Jitter: 0.1,
Steps: 6,
Cap: 10 * time.Minute,
}

err = kretry.OnError(retryBackoff, retry.IsErrorRetriable, func() (err error) {
return manager.forceRefresh()
})
if err != nil {
return nil, err
}

Expand Down

0 comments on commit 554366f

Please sign in to comment.