File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
staging/src/k8s.io/legacy-cloud-providers/azure Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import (
20
20
"fmt"
21
21
"io"
22
22
"io/ioutil"
23
+ "net/http"
23
24
"strings"
24
25
"sync"
25
26
"time"
@@ -238,6 +239,20 @@ type Cloud struct {
238
239
}
239
240
240
241
func init () {
242
+ // In go-autorest SDK https://github.com/Azure/go-autorest/blob/master/autorest/sender.go#L258-L287,
243
+ // if ARM returns http.StatusTooManyRequests, the sender doesn't increase the retry attempt count,
244
+ // hence the Azure clients will keep retrying forever until it get a status code other than 429.
245
+ // So we explicitly removes http.StatusTooManyRequests from autorest.StatusCodesForRetry.
246
+ // Refer https://github.com/Azure/go-autorest/issues/398.
247
+ // TODO(feiskyer): Use autorest.SendDecorator to customize the retry policy when new Azure SDK is available.
248
+ statusCodesForRetry := make ([]int , 0 )
249
+ for _ , code := range autorest .StatusCodesForRetry {
250
+ if code != http .StatusTooManyRequests {
251
+ statusCodesForRetry = append (statusCodesForRetry , code )
252
+ }
253
+ }
254
+ autorest .StatusCodesForRetry = statusCodesForRetry
255
+
241
256
cloudprovider .RegisterCloudProvider (CloudProviderName , NewCloud )
242
257
}
243
258
You can’t perform that action at this time.
0 commit comments