Skip to content

Conversation

tthvo
Copy link
Contributor

@tthvo tthvo commented Sep 23, 2025

What type of PR is this?
/kind bug

What this PR does / why we need it:

In AWS SDKv1, each service exports a constant EndpointsID to look up the custom service endpoint, for example, see ref [0]. In AWS SDKv2, these contants are no longer available. Thus, for backwards compatibility, we copy those constants from the SDKv1 and map them to the corresponding ServiceID in SDK v2.

Additionally, in AWS SDKv1, elb and elbv2 uses the same identifier (i.e. same EndpointsID), thus the same custom endpoint [1] [2]. For backwards compatibility, if elbv2 endpoint is undefined, elbv2 endpoint resolver should fall back to elb endpoint if any.

This also fixes the bug where CAPA does not recognize services that define its serviceID with more than 1 word due to the incorrect assumption endpoints.go#L90-L94). The services are:

  • Elastic Load Balancing
  • Elastic Load Balancing v2
  • Resource Groups Tagging API
  • EventBridge
  • Secrets Manager

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #5670

Special notes for your reviewer:

Checklist:

  • squashed commits
  • includes documentation
  • includes emoji in title
  • adds unit tests
  • adds or updates e2e tests

Release note:

ensure custom service endpoints for supported AWS services are properly selected by
both AWS SDKv2 and SDKv1 service ID (for backwards compatibility) 

In AWS SDKv1, each service exports a constant EndpointsID to look up the
custom service endpoint, for example, see ref [0]. In AWS SDKv2, these
contants are no longer available.

Thus, for backwards compatibility, we copy those constants from the
SDKv1 and map them to the corresponding ServiceID in SDK v2.

Additionally, in AWS SDKv1, elb and elbv2 uses the same identifier (i.e.
same EndpointsID), thus the same custom endpoint [1][2]. For backwards
compatibility, if elbv2 endpoint is undefined, elbv2 endpoint resolver
should fall back to elb endpoint if any.

This also fixes the bug where CAPA does not recognize services that define
its serviceID with more than 1 word due to the incorrect assumption [3].

References:

[0] https://github.com/aws/aws-sdk-go/blob/070853e88d22854d2355c2543d0958a5f76ad407/service/resourcegroupstaggingapi/service.go#L33-L34
[1] https://github.com/aws/aws-sdk-go/blob/070853e88d22854d2355c2543d0958a5f76ad407/service/elbv2/service.go#L32-L33
[2] https://github.com/aws/aws-sdk-go/blob/070853e88d22854d2355c2543d0958a5f76ad407/service/elb/service.go#L32-L33
[2] https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/88cb4b92b1a76591623e9d5ef347bfdc22010622/pkg/cloud/endpoints/endpoints.go#L90-L94
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority labels Sep 23, 2025
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 23, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @tthvo. 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 /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.

@damdo
Copy link
Member

damdo commented Sep 23, 2025

Cc. @punkwalker

@damdo
Copy link
Member

damdo commented Sep 23, 2025

/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 Sep 23, 2025
Copy link
Member

@damdo damdo left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this

/lgtm

/assign @richardcase @nrb

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 23, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: db425f99a2ecae7ffe35f04d4036734139e1fb76

@damdo
Copy link
Member

damdo commented Sep 23, 2025

/cherry-pick release-2.9

@k8s-infra-cherrypick-robot

@damdo: once the present PR merges, I will cherry-pick it on top of release-2.9 in a new PR and assign it to you.

In response to this:

/cherry-pick release-2.9

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.

@nrb
Copy link
Contributor

nrb commented Sep 23, 2025

/approve
/hold
until the question about endpoint coverage is answered.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 23, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nrb

The full list of commands accepted by this bot can be found here.

The pull request process is described 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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 23, 2025
@nrb
Copy link
Contributor

nrb commented Sep 23, 2025

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 23, 2025
@k8s-ci-robot k8s-ci-robot merged commit bd8766a into kubernetes-sigs:main Sep 23, 2025
25 checks passed
@k8s-infra-cherrypick-robot

@damdo: new pull request created: #5682

In response to this:

/cherry-pick release-2.9

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Custom Service Endpoints are not selected after AWS SDK v2 migration

6 participants