Conversation
Signed-off-by: somaz <genius5711@gmail.com>
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @somaz94! |
|
Hi @somaz94. 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 Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
What does it do ?
Splits
ExoscaleProvider.ApplyChangesinto per-operation helpers (createRecords,updateRecords,deleteRecords) plus two shared helpers:resolveZonefor thedomain-filter and zone lookup that all three repeated, and
findRecordIDfor thename and type record match that update and delete duplicated verbatim.
This lowers the function's cyclomatic complexity from 26 to 6, with no new helper
above 7, leaving
merge(9) as the package maximum. Output, ordering, errorpropagation and the number of API calls are unchanged.
Part of #5419.
Motivation
ApplyChangeswas the most complex function in the provider, and the update anddelete paths had drifted into near-identical copies of the same record lookup.
Separating them makes each operation reviewable on its own as the project lowers
its
cyclopthreshold.Testing
go test -race -count=1 ./provider/exoscale/(20 tests)make test(full suite, all packages)golangci-lint run --timeout=10m ./provider/exoscale/...(0 issues)make licensecheckcyclopwithmax-complexity: 1to read the exact numbers before and afterListDNSDomainRecordserror path and theno-matching-record path, neither of which was covered before. Both pass
unmodified against the pre-refactor code, so they check that the behavior is
the same rather than only that the new structure works.
AI assistance
Claude Code helped with the refactor and the two added tests. I reviewed the
result and checked the behavior myself with the test suite and linters.
More