Skip to content

Commit

Permalink
Merge pull request #81338 from feiskyer/automated-cherry-pick-of-#812…
Browse files Browse the repository at this point in the history
…79-upstream-release-1.15

Automated cherry pick of #81279: Fix Azure client requests stuck issues on
  • Loading branch information
k8s-ci-robot committed Aug 16, 2019
2 parents cba0944 + acbf914 commit 540f7f2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions staging/src/k8s.io/legacy-cloud-providers/azure/azure.go
Expand Up @@ -20,6 +20,7 @@ import (
"fmt"
"io"
"io/ioutil"
"net/http"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -226,6 +227,20 @@ type Cloud struct {
}

func init() {
// In go-autorest SDK https://github.com/Azure/go-autorest/blob/master/autorest/sender.go#L258-L287,
// if ARM returns http.StatusTooManyRequests, the sender doesn't increase the retry attempt count,
// hence the Azure clients will keep retrying forever until it get a status code other than 429.
// So we explicitly removes http.StatusTooManyRequests from autorest.StatusCodesForRetry.
// Refer https://github.com/Azure/go-autorest/issues/398.
// TODO(feiskyer): Use autorest.SendDecorator to customize the retry policy when new Azure SDK is available.
statusCodesForRetry := make([]int, 0)
for _, code := range autorest.StatusCodesForRetry {
if code != http.StatusTooManyRequests {
statusCodesForRetry = append(statusCodesForRetry, code)
}
}
autorest.StatusCodesForRetry = statusCodesForRetry

cloudprovider.RegisterCloudProvider(CloudProviderName, NewCloud)
}

Expand Down

0 comments on commit 540f7f2

Please sign in to comment.