Skip to content

cluster-autoscaler: vendor aws-sdk-go-v2 #8265

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

domenicbozzuto
Copy link
Contributor

@domenicbozzuto domenicbozzuto commented Jun 24, 2025

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

The aws sdk for go (aws-sdk-go) is reaching its end of life at the end of July 2025. The proper course of action is to transition to the new aws-sdk-go-v2 module that is mostly a drop in replacement for the deprecated v1 version.

As discussed at sig-autoscaling's June 23, 2025 session, the plan is to have 3 PRs to upgrade to the v2 sdk (add v2, adopt v2, drop v1). This PR is 1 of 3 to resolve #7093, and is responsible for vendoring the aws-sdk-go-v2 package, as well as the aws/smithy-go package (smithy provides the basis for a lot of AWS's http stack and is heavily depended on by the v2 sdk, so I'm vendoring this as well).

The aws-sdk-go-v2 is large; with tests and other unneeded files removed, it still adds ~450Mi of content. For comparison, the v1 sdk is ~200Mi (and once that's removed, the net-new increase in size will be ~250Mi). Most of the size comes from the individual modules within service/; there's a potential opportunity to limit vendoring to only the modules needed (ec2, eks, autoscaling), at the cost of adding complexity to the logic to do future vendoring updates.

This PR should effectively be a no-op and will not change any current behavior, as the v2 sdk is not actively consumed.

Special notes for your reviewer:

This PR adds a lot of new files; the first commit identifies the commands that will be used to generate the files needed to vendor the modules, and the second commit is purely running those commands to actually vendor the packages.

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 24, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @domenicbozzuto. Thanks for your PR.

I'm waiting for a kubernetes 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 24, 2025
@k8s-ci-robot k8s-ci-robot added area/cluster-autoscaler area/provider/aws Issues or PRs related to aws provider labels Jun 24, 2025
@domenicbozzuto domenicbozzuto force-pushed the dom.bozzuto/vendor-aws-sdk-v2-and-smithy branch from 00f368b to 805e676 Compare June 24, 2025 15:23
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 24, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: domenicbozzuto
Once this PR has been reviewed and has the lgtm label, please assign drmorr0 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 added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 24, 2025
@domenicbozzuto domenicbozzuto force-pushed the dom.bozzuto/vendor-aws-sdk-v2-and-smithy branch 4 times, most recently from a8482fa to 794a1ac Compare June 24, 2025 18:43
go test -count=1 ./... -vet="${ANALYZERS}"
# These vendored directories have explicitly been stripped of _test.go files, so avoid searching/compiling for them
# when recursively searching for tests
go test -count=1 $(go list ./... | grep -v cloudprovider/aws/aws-sdk-go | grep -v cloudprovider/aws/aws-sdk-go-v2 | grep -v cloudprovider/aws/smithy-go) -vet="${ANALYZERS}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was running into an issue where the Test action would consistently fail with a full-disk error. Upon inspection, go test ./... was compiling each of the packages in aws-sdk-go-v2 despite them not containing any tests, and filling up the disk with those binaries. (I cleaned my local cache and did a go test ./... on just aws-sdk-go-v2, and saw it generated ~5.2Gi of content in my cache).

@domenicbozzuto domenicbozzuto force-pushed the dom.bozzuto/vendor-aws-sdk-v2-and-smithy branch from 794a1ac to 4c7038b Compare June 24, 2025 20:22
@domenicbozzuto domenicbozzuto changed the title WIP: Vendor aws-sdk-go-v2 cluster-autoscaler: vendor aws-sdk-go-v2 Jun 24, 2025
@domenicbozzuto domenicbozzuto marked this pull request as ready for review June 25, 2025 13:02
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2025
@k8s-triage-robot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@rrangith
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 Jun 25, 2025
Copy link
Member

@rrangith rrangith left a comment

Choose a reason for hiding this comment

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

/lgtm

## Update imports to local path
find ./aws-sdk-go-v2 -name '*.go' -type f -exec sed -i '' 's#github.com/aws/aws-sdk-go-v2#k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go-v2#' {} \+
find ./aws-sdk-go-v2 -name '*.go' -type f -exec sed -i '' 's#github.com/aws/smithy-go#k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/smithy-go#' {} \+
```
Copy link
Member

Choose a reason for hiding this comment

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

I pulled this branch and ran the commands:

export SDK_VERSION="2025-06-17"
export SMITHY_VERSION="1.22.4"

# Prepare clean smithy-go folder
## Clean up old release
rm -rf smithy-go/

## Download and extract specified release
curl -L "https://github.com/aws/smithy-go/archive/refs/tags/v${SMITHY_VERSION}.tar.gz" -o smithy-go.tar.gz
tar xf smithy-go.tar.gz
mv "smithy-go-${SMITHY_VERSION}" smithy-go
rm smithy-go.tar.gz

# Adjust for vendoring within cluster-autoscaler 
## Remove unneeded files, directories, and tests to reduce size
rm -r ./smithy-go/.github ./smithy-go/codegen ./smithy-go/.travis.yml
find ./smithy-go \( -name "*_test.go" -o -name 'go.mod' -o -name 'go.sum' \) -exec rm {} \+

## Update paths for local vendoring
find ./smithy-go -name '*.go' -type f -exec sed -i '' 's#github.com/aws/smithy-go#k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/smithy-go#' {} \+

# Prepare clean sdk-v2 folder
## Clean up old release
rm -rf aws-sdk-go-v2/

## Download and extract specified release
curl -L "https://github.com/aws/aws-sdk-go-v2/archive/refs/tags/release-${SDK_VERSION}.tar.gz" -o aws-sdk-go-v2.tar.gz
tar xf aws-sdk-go-v2.tar.gz
mv "aws-sdk-go-v2-release-${SDK_VERSION}" aws-sdk-go-v2
rm aws-sdk-go-v2.tar.gz

# Adjust for vendoring within cluster-autoscaler
## Remove unneeded files, directories, and tests to reduce size
rm ./aws-sdk-go-v2/.travis.yml ./aws-sdk-go-v2/.golangci.toml ./aws-sdk-go-v2/buildspec.yml ./aws-sdk-go-v2/ci-find-smithy-go.sh ./aws-sdk-go-v2/local-mod-replace.sh ./aws-sdk-go-v2/modman.toml
rm -r ./aws-sdk-go-v2/.github ./aws-sdk-go-v2/codegen ./aws-sdk-go-v2/example ./aws-sdk-go-v2/internal/codegen ./aws-sdk-go-v2/internal/repotools
find ./aws-sdk-go-v2 \( -name "*_test.go" -o -name "*.go.snap" -o -name 'go.mod' -o -name 'go.sum' \) -exec rm {} \+

## Update imports to local path
find ./aws-sdk-go-v2 -name '*.go' -type f -exec sed -i '' 's#github.com/aws/aws-sdk-go-v2#k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go-v2#' {} \+
find ./aws-sdk-go-v2 -name '*.go' -type f -exec sed -i '' 's#github.com/aws/smithy-go#k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/smithy-go#' {} \+

I had no diff, so was successfully able to regenerate the exact same vendors 👍🏾

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cluster-autoscaler area/provider/aws Issues or PRs related to aws provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. 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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

switch to aws-sdk-go-v2 as v1 is going away
4 participants