Skip to content

Conversation

@alexander-demicev
Copy link
Contributor

What type of PR is this?

/kind cleanup
/kind deprecation

What this PR does / why we need it:

This PR migrates sts to sdk v2. There are still some leftovers in identity package that can only be removed once all SDK migration is done.

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 #5413

Special notes for your reviewer:

Checklist:

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

Release note:

Migrate sts to sdk v2

@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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. labels Jul 30, 2025
@k8s-ci-robot k8s-ci-robot requested review from nrb and serngawy July 30, 2025 13:55
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 30, 2025
@alexander-demicev alexander-demicev changed the title Migrate sts to sdk v2 🌱 Migrate sts to sdk v2 Jul 30, 2025
@alexander-demicev
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e-eks
/test pull-cluster-api-provider-aws-e2e

@nrb nrb mentioned this pull request Jul 30, 2025
5 tasks
@alexander-demicev alexander-demicev force-pushed the stsv2 branch 2 times, most recently from 302e252 to e8f4355 Compare July 30, 2025 19:59
@alexander-demicev
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e-eks
/test pull-cluster-api-provider-aws-e2e

@nrb
Copy link
Contributor

nrb commented Jul 30, 2025

/retest

Couldn't allocate a testing account

@nrb
Copy link
Contributor

nrb commented Jul 30, 2025

Really only one change that I can see that's needed, thanks!

@alexander-demicev
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e-eks
/test pull-cluster-api-provider-aws-e2e

@alexander-demicev
Copy link
Contributor Author

I'm running into an issue where connecting EKS clusters is failing after the change. I suspect it's related to the token that's being generated. I'm not an expert in EKS internals, but I noticed a difference in how the AWS SDK v1 vs v2 generates the token:

  • v1 uses the global STS endpoint - sts.amazonaws.com, us-east-1
  • v2 defaults to the regional STS endpoint - sts.$(MY_REGION).amazonaws.com)
  • v1 explicitly sets the expiration, with v2 I wasn't to figure it out

@damdo
Copy link
Member

damdo commented Aug 4, 2025

Hm maybe @punkwalker can help @alexander-demicev ?

@punkwalker
Copy link
Contributor

punkwalker commented Aug 4, 2025

Hm maybe @punkwalker can help @alexander-demicev ?

I'm running into an issue where connecting EKS clusters is failing after the change. I suspect it's related to the token that's being generated. I'm not an expert in EKS internals, but I noticed a difference in how the AWS SDK v1 vs v2 generates the token:

  • v1 uses the global STS endpoint - sts.amazonaws.com, us-east-1
  • v2 defaults to the regional STS endpoint - sts.$(MY_REGION).amazonaws.com)
  • v1 explicitly sets the expiration, with v2 I wasn't to figure it out

I will take a look at how CAPA does token generation but here is some reference - https://github.com/kubernetes-sigs/aws-iam-authenticator/blob/325c38ccbbd395e3bf612205809af77fe3f923ce/pkg/token/token.go#L227

With V2, STS uses regional endpoint so the generated token should target regional endpoint. Also, STS token expiration is default 15 mins with V2 as well.
Note: EKS uses aws-iam-authenticator on server side for token validation.

@punkwalker
Copy link
Contributor

punkwalker commented Aug 4, 2025

Signed-off-by: Alexandr Demicev <[email protected]>
@alexander-demicev
Copy link
Contributor Author

/test pull-cluster-api-provider-aws-e2e-eks
/test pull-cluster-api-provider-aws-e2e

@damdo
Copy link
Member

damdo commented Aug 4, 2025

Invalid token flake:

/test pull-cluster-api-provider-aws-e2e-eks

@punkwalker
Copy link
Contributor

/test pull-cluster-api-provider-aws-e2e

1 similar comment
@damdo
Copy link
Member

damdo commented Aug 5, 2025

/test pull-cluster-api-provider-aws-e2e

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 @alexander-demicev

/lgtm

/assign @richardcase @nrb @AndiDog @dlipovetsky

for approval

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

LGTM label has been added.

Git tree hash: 019c0dcf6215d0f88dc7ae8ae2c17b355ceef87f

@richardcase
Copy link
Member

Thanks for this @alexander-demicev

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: richardcase

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 Aug 5, 2025
@damdo
Copy link
Member

damdo commented Aug 5, 2025

/retest

@k8s-ci-robot k8s-ci-robot merged commit 47820e4 into kubernetes-sigs:main Aug 5, 2025
20 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v2.8 milestone Aug 5, 2025
@alexander-demicev alexander-demicev deleted the stsv2 branch August 5, 2025 11:26
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/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/deprecation Categorizes issue or PR as related to a feature/enhancement marked for deprecation. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

Migrate sts code to AWS SDK v2

8 participants