mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Fix Azure client requests stuck issues on http.StatusTooManyRequests
This commit is contained in:
parent
0610bf0c7e
commit
e53c57a307
@ -20,6 +20,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -238,6 +239,20 @@ type Cloud struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
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)
|
cloudprovider.RegisterCloudProvider(CloudProviderName, NewCloud)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user