-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(godaddy): Handle missing Retry-After header gracefully #4866
base: master
Are you sure you want to change the base?
fix(godaddy): Handle missing Retry-After header gracefully #4866
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Welcome @alexstojda! |
Hi @alexstojda. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Hi alextojda! I saw your comment and am writing here to discuss. Thank you for actively working to solve the same problem. I also thought about reading the body message of the response to determine the exact situation of monthly quota exceeded. func (c *Client) CallAPIWithContext(ctx context.Context, method, path string, reqBody, resType interface{}, needAuth bool) error {
req, err := c.NewRequest(method, path, reqBody, needAuth)
if err != nil {
return err
}
req = req.WithContext(ctx)
response, err := c.Do(req)
if err != nil {
return err
}
return c.UnmarshalResponse(response, resType) // read body message with Reader
} As a result, it was judged that reading the body message with io.Reader in In the case of a 429 response within the |
e242c1b
to
53f4519
Compare
53f4519
to
c4dfbe4
Compare
- Also cleanup code for function
@rayshoo thanks for pointing that out. After doing some testing, I decided a simpler approach would be to just handle the missing I also modified the error handling of the validation step on startup to only panic when the error is not a |
/ok-to-test |
@alexstojda BTW, you may have noticed that we have started the process to move providers out of tree. Would you be interested in moving this provider out of tree ? |
Many thanks for adding a test.You'll need to add the license header and I should be able to lgtm it. |
c4dfbe4
to
fc000f0
Compare
@mloiseleur I could be interested in taking that on, but I predict I won't have the bandwidth to do so until April/May-ish.
Done! |
func (c *Client) CallAPIWithContext(ctx context.Context, method, path string, reqBody, resType interface{}, needAuth bool) error { | ||
req, err := c.NewRequest(method, path, reqBody, needAuth) | ||
func (c *Client) CallAPIWithContext(ctx context.Context, method, path string, reqBody, resType interface{}) error { | ||
req, err := c.NewRequest(method, path, reqBody) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexstojda Would you please detail why you are removing the needAuth
boolean which is set to true on all call ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My local linter complained about this as the variable is unused in the function.
Description
Based on some testing, it seems GoDaddy has an undocumented, per-endpoint quota.
During startup, the client calls the endpoint
https://api.godaddy.com/v1/domains?statuses=ACTIVE,PENDING_DNS_ACTIVE1
to test and validate that the credentials are working. Calling that endpoint with the same API key manually, I was able to reproduce the429
response the API sends, which did not include theRetry-After
header and thus caused the panic on startup.However, I was able to call other endpoints, ex:
https://api.godaddy.com/v1/domains/<domain>/records
, leading me to believe there is an undocumented, per-endpoint quota.With this in mind, I updated the request handler to gracefully fail without panicing when the header is missing, so that other requests can still be attempted.
Fixes #4864
Checklist