-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore(cloudflare): migrate customhostname to v5 #5891
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
base: master
Are you sure you want to change the base?
chore(cloudflare): migrate customhostname to v5 #5891
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 |
Pull Request Test Coverage Report for Build 19845553576Details
💛 - Coveralls |
|
@vflaux @mrozentsvayg Any comment on this PR ? Do you think you can review it ? |
provider/cloudflare/cloudflare.go
Outdated
| if strings.Contains(errStr, "exceeded available rate limit retries") || | ||
| strings.Contains(errStr, "rate limit") || | ||
| strings.Contains(errStr, "429") { |
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.
I think we should handle this according to the doc here: https://github.com/cloudflare/cloudflare-go?tab=readme-ov-file#errors
var apierr *cloudflare.Error
if errors.As(err, &apierr) {
if apierr.StatusCode == http.StatusTooManyRequests {
}
}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.
This was implemented
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.
so why do we have this code here?
- Rate limit errors are not returned as ErrorTypeRateLimit cloudflare/cloudflare-go#4155 talks about the v0 version of the library which we don't use after merging your PR.
- the first string.Contains is not needed if you have the second one.
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.
Sorry forgot to commit it. It's gone now
|
@vflaux: changing LGTM is restricted to collaborators In response to this: 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. |
|
How did broken tests get merged in? |
This should be fixed, see #5896. |
|
/retest |
|
@vflaux everything look good now? |
vflaux
left a comment
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.
I've not review all the new tests yet.
Looks like IA generated, some clearly improve test coverage, others seems less relevant. 😄
|
The tests just fail because of rate limits to coveralls |
|
Did you @AndrewCharlesHay address comments by @vflaux ? Cleaning up things that are not useful is always great for maintaining the software. |
|
@szuecs yep all updated |
|
@AndrewCharlesHay Would you please rebase ? |
e0eb277 to
bcad628
Compare
Co-authored-by: Michel Loiseleur <[email protected]>
…Flare API - Change CustomHostnames method signature to return autoPager[CustomHostnameListResponse] instead of processed []CustomHostname for better API matching and testability - Keep listAllCustomHostnames helper function for callers that need processed results - Update mock implementation to return autoPager with realistic CloudFlare API behavior - All tests continue to pass with improved interface design Addresses PR feedback about method signatures being closer to CloudFlare API for better mocking.
- Handle CloudFlare v5 SDK errors according to official documentation - Use errors.As() to check for cloudflare.Error type - Convert 429 (rate limit) status codes to SoftError for retry logic - Add comprehensive test coverage for v5 error handling - Use wrapper types in tests to avoid CloudFlare SDK internal nil pointer issues Addresses PR comment on line 376 requesting proper v5 error handling.
Co-authored-by: vflaux <[email protected]>
…rkaround no longer needed, per reviewer feedback)
- Update convertCloudflareError to detect rate limit keywords in error messages - Check for 'rate limit' and '429' in error strings - Fixes failing rate limit error tests
Co-authored-by: vflaux <[email protected]>
Co-authored-by: vflaux <[email protected]>
2bd7e13 to
46c5795
Compare
… comments - Add comprehensive test coverage for buildCustomHostnameNewParams function - Improve comment explaining why string-based rate limit detection is needed with v5 SDK (SDK's retry logic can wrap errors hiding structured types) - Addresses reviewer feedback about test coverage and error handling rationale
mloiseleur
left a comment
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.
@vflaux Anything left on your side ?
|
Was this code tested against cloudflare? Change does look riskie without testing. |
What does it do ?
Migrate customhostname to v5
Motivation
Closes #5540
More