Skip to content

Conversation

@u-kai
Copy link
Contributor

@u-kai u-kai commented Dec 12, 2025

What does it do?

This PR refactors the alias-handling logic inside adjustEndpointAndNewAaaaIfNeeded and prepares the codebase for upcoming fixes in #5997 and #6017.

To ensure safety and correctness, the refactoring was performed in multiple verifiable stages:

  1. Extracted the existing logic
    In commit 7fda240, the original implementation was split into
    oldAdjustEndpointAndNewAaaaIfNeeded and a new adjustEndpointAndNewAaaaIfNeeded,
    with the latter simply delegating to the former.

  2. Added comprehensive compatibility tests
    These tests verified that both functions returned identical results for all meaningful input patterns.
    This test suite ensured that extraction did not introduce any behavioral changes.

  3. Refactored the new implementation
    In commit b50b0a5, the new function was rewritten for clarity and testability.
    The compatibility tests confirmed the refactored logic remained fully identical to the old version.

  4. Removed the old logic and updated tests
    After strict behavioral parity was confirmed, the old function and compatibility tests were removed.
    The test suite was rewritten to validate the intended behavior directly.

This staged process allowed the refactoring to be completed safely while maintaining full functional equivalence throughout the transition.

Motivation

This work originates from the discussion here:
#5997 (comment)

To make future fixes #5997 and #6017 easier and safer to apply, the logic needed to be isolated, simplified, and thoroughly tested.

More

  • Yes, this PR title follows Conventional Commits
  • Yes, I added unit tests
  • Yes, I updated end user documentation accordingly

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 12, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @u-kai. Thanks for your PR.

I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the internal Issues or PRs related to internal code label Dec 12, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign ivankatliarchuk for approval. For more information see the Code Review Process.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from szuecs December 12, 2025 10:46
@k8s-ci-robot k8s-ci-robot added provider Issues or PRs related to a provider size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 12, 2025
@ivankatliarchuk
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 13, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 20164321325

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 33 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.04%) to 78.728%

Files with Coverage Reduction New Missed Lines %
testutils/endpoint.go 6 77.42%
aws/aws.go 27 91.47%
Totals Coverage Status
Change from base Build 20163464704: 0.04%
Covered Lines: 16040
Relevant Lines: 20374

💛 - Coveralls

Copy link
Member

@ivankatliarchuk ivankatliarchuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not a big deal, there were some missing lines not covered with tests

before
Screenshot 2025-12-13 at 11 07 39

with the change
Screenshot 2025-12-13 at 11 10 06

@u-kai
Copy link
Contributor Author

u-kai commented Dec 13, 2025

@ivankatliarchuk

Thank you for taking a look.

I don’t think the missing test coverage in the previous tests is a problem, since the behavior between the previous implementation and the refactored one has already been verified to be identical by the comprehensive tests added in commit b50b0a.

The currently untested case is essentially:

if providerSpecificAlias does not exist, nothing happens

if it does exist, it gets removed

In both cases, the final outcome is the same — providerSpecificAlias is absent.
Because of that, my personal view is that adding a dedicated test for this scenario may not be strictly necessary.

That said, if you think it should be covered explicitly, I’m happy to add a test.
What do you think?

@ivankatliarchuk
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. internal Issues or PRs related to internal code lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. provider Issues or PRs related to a provider size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants