Skip to content

Commit 805e676

Browse files
Update readme to explain how to vendor aws-sdk-go-v2
1 parent c509bb2 commit 805e676

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

cluster-autoscaler/cloudprovider/aws/README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,8 @@ To refresh static list, please run `go run ec2_instance_types/gen.go` under
425425

426426
## Using the AWS SDK vendored in the AWS cloudprovider
427427

428+
### v1
429+
428430
If you want to use a newer version of the AWS SDK than the version currently vendored as a direct dependency by Cluster Autoscaler, then you can use the version vendored under this AWS cloudprovider.
429431

430432
The current version vendored is `v1.48.7`.
@@ -436,6 +438,60 @@ If you want to update the vendored AWS SDK to a newer version, please make sure
436438
3. Update the import statements within the newly-copied AWS SDK to reference the new paths (e.g., `github.com/aws/aws-sdk-go/aws/awsutil` -> `k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go/aws/awsutil`). You can use this command from the aws-sdk-go folder `find . -type f -exec sed -i ‘s#github.com/aws/aws-sdk-go#k8s.io/autoscaler/cluster-autoscaler/cloudprovider/aws/aws-sdk-go#’ {} \;`
437439
4. Update the version number above to indicate the new vendored version.
438440

441+
### v2
442+
If you want to use a newer version of the AWS SDK than the version currently vendored as a direct dependency by Cluster Autoscaler, then you can use the version vendored under this AWS cloudprovider.
443+
444+
The current version vendored is `2025-06-17`.
445+
446+
The aws-sdk-go-v2 also depends on aws/smithy-go; this is similarly vendored; check the go.mod of the aws-sdk-go-v2 package for the correct version of this package.
447+
448+
The current version vendored is `v1.22.4`
449+
450+
You can use the commands below to update the vendored copy of these modules to a newer version
451+
452+
```shell
453+
export SDK_VERSION="2025-06-17"
454+
export SMITHY_VERSION="1.22.4"
455+
456+
# Prepare clean smithy-go folder
457+
## Clean up old release
458+
rm -rf smithy-go/
459+
460+
## Download and extract specified release
461+
curl -L "https://github.com/aws/smithy-go/archive/refs/tags/v${SMITHY_VERSION}.tar.gz" -o smithy-go.tar.gz
462+
tar xf smithy-go.tar.gz
463+
mv "smithy-go-${SMITHY_VERSION}" smithy-go
464+
rm smithy-go.tar.gz
465+
466+
# Adjust for vendoring within cluster-autoscaler
467+
## Remove unneeded files, directories, and tests to reduce size
468+
rm -r ./smithy-go/.github ./smithy-go/codegen ./smithy-go/.travis.yml
469+
find ./smithy-go \( -name "*_test.go" -o -name 'go.mod' -o -name 'go.sum' \) -exec rm {} \+
470+
471+
## Update paths for local vendoring
472+
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#' {} \+
473+
474+
# Prepare clean sdk-v2 folder
475+
## Clean up old release
476+
rm -rf aws-sdk-go-v2/
477+
478+
## Download and extract specified release
479+
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
480+
tar xf aws-sdk-go-v2.tar.gz
481+
mv "aws-sdk-go-v2-release-${SDK_VERSION}" aws-sdk-go-v2
482+
rm aws-sdk-go-v2.tar.gz
483+
484+
# Adjust for vendoring within cluster-autoscaler
485+
## Remove unneeded files, directories, and tests to reduce size
486+
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
487+
rm -r ./aws-sdk-go-v2/.github ./aws-sdk-go-v2/internal/codegen ./aws-sdk-go-v2/internal/repotools
488+
find ./aws-sdk-go-v2 \( -name "*_test.go" -o -name "*.go.snap" -o -name 'go.mod' -o -name 'go.sum' \) -exec rm {} \+
489+
490+
## Update imports to local path
491+
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#' {} \+
492+
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#' {} \+
493+
```
494+
439495
## Using cloud config with helm
440496

441497
If you want to use custom AWS cloud config e.g. endpoint urls

hack/verify-gofmt.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ find_files() {
3636
-o -wholename '*/vendor/*' \
3737
-o -wholename '*/zz_generated.deepcopy.go' \
3838
-o -wholename './cluster-autoscaler/cloudprovider/aws/aws-sdk-go/*' \
39+
-o -wholename './cluster-autoscaler/cloudprovider/aws/aws-sdk-go-v2/*' \
40+
-o -wholename './cluster-autoscaler/cloudprovider/aws/smithy-go/*' \
3941
-o -wholename './cluster-autoscaler/cloudprovider/magnum/gophercloud/*' \
4042
-o -wholename './cluster-autoscaler/cloudprovider/digitalocean/godo/*' \
4143
-o -wholename './cluster-autoscaler/cloudprovider/bizflycloud/gobizfly/*' \

0 commit comments

Comments
 (0)