-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Migrate aws sdk go v1 to v2 #3844
Conversation
/retest |
@@ -106,6 +110,20 @@ func (p *suffixAnnotationParser) ParseInt64Annotation(annotation string, value * | |||
return true, nil | |||
} | |||
|
|||
func (p *suffixAnnotationParser) ParseInt32Annotation(annotation string, value *int32, annotations map[string]string, opts ...ParseOption) (bool, error) { |
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.
Why do we need this ParseInt32Annotation()
in addition to ParseInt64Annotation()
?
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.
Theaws-sdk-v2 now migrated all the int64 types to int32. Hence to minimize the conversions after parsing. I have created a new parsing method.
/retest |
/retest pull-aws-load-balancer-controller-e2e-test |
@shraddhabang: The
Use
In response to this:
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. |
/test pull-aws-load-balancer-controller-e2e-test |
pkg/annotations/parser.go
Outdated
if !exists { | ||
return false, nil | ||
} | ||
i, err := strconv.ParseInt(raw, 10, 64) |
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.
should be 32 instead of 64
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.
Fixed. :D
} | ||
sess := session.Must(session.NewSessionWithOptions(opts)) | ||
injectUserAgent(&sess.Handlers) | ||
awsConfig, err := config.LoadDefaultConfig(context.TODO(), |
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.
- cfg.AWSEndpoints seems dropped support? It's a flag used to override api endpoints (e.g. FIPS ones).
- seems endpoints.RegionalSTSEndpoint is not explicitly specified, is it the default behavior of AWSSDKv2? We don't want to use global STS endpoint.
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 have verified that the GO SDK v2 uses regional STS endpoints by default. https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html#:~:text=SDK%20for%20Go%20V2,Request%20failure
Good catch. I have added support for custom AWSEndpoints now in recent commit. Please take a look.
pkg/aws/cloud.go
Outdated
if metricsRegisterer != nil { | ||
metricsCollector, err := metrics.NewCollector(metricsRegisterer) | ||
if err != nil { | ||
return nil, errors.Wrapf(err, "failed to initialize sdk metrics collector") | ||
} | ||
metricsCollector.InjectHandlers(&sess.Handlers) | ||
awsConfig.APIOptions = append(awsConfig.APIOptions, func(stack *smithymiddleware.Stack) error { | ||
return metrics.WithSDKCallMetricCollector(metricsCollector)(stack) |
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'd prefer to have a single method like WithSDKMetricsCollector
instead of two. If we want to support optional collect either call/request metrics only, we can pass the setting into WithSDKMetricsCollector.
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.
Makes sense. I have fixed this in recent commit
left a few comments. I'm ok to merge this into |
/test pull-aws-load-balancer-controller-e2e-test |
1 similar comment
/test pull-aws-load-balancer-controller-e2e-test |
/lgtm |
/test pull-aws-load-balancer-controller-e2e-test |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: oliviassss, shraddhabang 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 |
* Migrate aws sdk go v1 to v2 * Migrate aws sdk go v1 to v2 * Adding pending tasks * Fix the endpoint ports to avoid reconciles * Addressing Yang's comments * Resolve merge conflicts
Issue
#3784
Description
As AWS SDK for GO v1 has gone into maintenance mode, this PR migrates the AWS SDK for GO v1 to v2
The migration includes the following key changes:
Updated dependencies: The go.mod file has been modified to use the AWS SDK for Go v2 dependencies.
Package imports: All imports referencing the v1 SDK have been updated to use the v2 packages.
Service clients: Service clients have been created using the NewFromConfig method in v2.
Waiters: The waiter functionality has been migrated to use the new waiter pattern in v2.
API calls: API calls have been updated to use the correct parameters and data types in v2.
Benefits:
Improved performance and efficiency: The AWS SDK for Go v2 offers performance enhancements and new features.
Enhanced security: The v2 SDK incorporates security best practices and addresses potential vulnerabilities.
Simplified usage: The v2 SDK provides a more intuitive and streamlined API.
Testing:
Unit tests: Unit tests have been updated to ensure the code works as expected with the v2 SDK.
Integration tests: Integration tests have been run to verify compatibility with other components of the application.
Please review the changes carefully and provide any feedback or suggestions
Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯