-
Couldn't load subscription status.
- Fork 4.2k
Migrate cluster-autoscaler AWS provider from AWS SDK for Go v1 to v2 #8676
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?
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. 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. |
|
Hi @Copilot. Thanks for your PR. I'm waiting for a github.com 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. |
Co-authored-by: jackfrancis <1494193+jackfrancis@users.noreply.github.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Copilot 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 |
Co-authored-by: jackfrancis <1494193+jackfrancis@users.noreply.github.com>
Co-authored-by: jackfrancis <1494193+jackfrancis@users.noreply.github.com>
| github.com/NYTimes/gziphandler v1.1.1 // indirect | ||
| github.com/antlr4-go/antlr/v4 v4.13.0 // indirect | ||
| github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 // indirect | ||
| github.com/aws/aws-sdk-go-v2 v1.39.3 // indirect |
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.
shouldn't there be a corresponding explicit update to github.com/aws/aws-sdk-go-v2 instead of this set o indirect additions?
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.
in cluster-autoscaler/go.mod shouldn't there be a corresponding explicit update to github.com/aws/aws-sdk-go-v2 instead of just indirect additions?
Overview
This PR migrates the cluster-autoscaler AWS cloud provider from the end-of-life AWS SDK for Go v1 to the actively supported v2. AWS SDK for Go v1 reached end-of-support on July 31, 2025, making this migration critical for continued AWS support and security updates.
Motivation
Changes
Core Infrastructure
AWS Configuration (
aws_sdk_provider.go)session.NewSession()toconfig.LoadDefaultConfig()Service Clients (
aws_manager.go)autoscaling.New(sess)→autoscaling.NewFromConfig(cfg)API Call Updates
Pagination
Replaced v1's callback-based pagination with v2's token-based approach:
Context Support
All AWS API calls now require and properly use
context.Context:Type System Changes
SDK v2 introduced significant type changes for better type safety and reduced pointer usage:
Value Types vs Pointers
*autoscaling.Group→autoscalingtypes.AutoScalingGroup(value)*autoscaling.Instance→autoscalingtypes.Instance(value)[]*TagDescription→[]TagDescription(slice of values)Typed Enums
Replaced magic strings with typed enums:
*stringlifecycle states →autoscalingtypes.LifecycleStateenum*stringtaint effects →ekstypes.TaintEffectenumInteger Types
Updated for AWS API changes:
*int64→*int32int64(*value)where neededString Handling
Removed dependency on helper functions:
aws.StringValue(ptr)→ direct dereference with nil checksaws.StringSlice(slice)→ direct slice usage (now[]stringnot[]*string)Instance Type Handling (
aws_util.go)Updated EC2 instance type generation:
DescribeInstanceTypesPages()to token-based paginationint32notint64)Managed Node Groups (
aws_wrapper.go)Testing
This is a work-in-progress PR. The code changes are complete and ready for review, but additional work is needed:
Dependencies
Added AWS SDK for Go v2 packages:
github.com/aws/aws-sdk-go-v2/configgithub.com/aws/aws-sdk-go-v2/service/autoscalinggithub.com/aws/aws-sdk-go-v2/service/ec2github.com/aws/aws-sdk-go-v2/service/eksgithub.com/aws/aws-sdk-go-v2/feature/ec2/imdsThe v1 SDK (
github.com/aws/aws-sdk-go) will be removed in a follow-up commit once all tests pass.Breaking Changes
None expected for end users. This is an internal implementation change that maintains the same external API and behavior.
Related Issues
Fixes #[issue-number] - AWS SDK for Go v2 Support
Migration Notes
For developers extending the AWS provider:
github.com/aws/aws-sdk-go-v2/service/{service}/typescontext.Contextfor all AWS API callsNextTokeninstead of callback functionsStatus: 🚧 Work in Progress - Core migration complete, final type conversions and tests in progress
Original prompt
Fixes #8671
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.