-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
base: master
Are you sure you want to change the base?
cluster-autoscaler: vendor aws-sdk-go-v2 #8265
Conversation
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 Once the patch is verified, the new status will be reflected by the 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. |
00f368b
to
805e676
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: domenicbozzuto 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 |
a8482fa
to
794a1ac
Compare
hack/for-go-proj.sh
Outdated
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}" |
There was a problem hiding this comment.
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).
794a1ac
to
4c7038b
Compare
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. |
/ok-to-test |
There was a problem hiding this 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#' {} \+ | ||
``` |
There was a problem hiding this comment.
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 👍🏾
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?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: