diff --git a/cluster-autoscaler/cloudprovider/azure/azure_manager.go b/cluster-autoscaler/cloudprovider/azure/azure_manager.go index f2fc79b1ca9c..daa449f3cf09 100644 --- a/cluster-autoscaler/cloudprovider/azure/azure_manager.go +++ b/cluster-autoscaler/cloudprovider/azure/azure_manager.go @@ -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 ( @@ -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 }