-
Notifications
You must be signed in to change notification settings - Fork 610
🌱 Migrate gc to aws sdk v2 #5518
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: main
Are you sure you want to change the base?
🌱 Migrate gc to aws sdk v2 #5518
Conversation
7b8080f
to
1822ed1
Compare
1822ed1
to
adc451e
Compare
a75be30
to
b39b276
Compare
fccf39b
to
12a5c0a
Compare
/test pull-cluster-api-provider-aws-e2e |
12a5c0a
to
2cfd1e6
Compare
/assign @nrb |
Merging another PR unfortunately introduced some conflicts on this one. Also, the copyright for brand new files should be the current year. |
Migrate the garbage collection service and related components to use the AWS SDK v2. This involves updating dependencies, refactoring client initialization, and updating API calls within the GC logic. Adds new v2 specific converters, filters, and mocks. Migrate the garbage collection logic for AWS Application Load Balancers (ALBs) and Network Load Balancers (NLBs) to use the AWS SDK v2. Migrate the garbage collection logic for Classic Load Balancers (ELB) from the AWS SDK v1 to v2. Signed-off-by: Danil-Grigorev <[email protected]>
Signed-off-by: Danil-Grigorev <[email protected]>
e991120
to
13f92c2
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
@alexander-demicev would you be able to have a second look and re-add your LGTM if you are happy with it? |
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
LGTM label has been added. Git tree hash: cef4df8dd78cc2740930f3275f6bb2f33d481ebf
|
/test pull-cluster-api-provider-aws-e2e |
/hold for testing to pass |
ResourceTagging resourcegroupstaggingapiiface.ResourceGroupsTaggingAPIAPI | ||
ASG autoscaling.Client | ||
EC2 ec2iface.EC2API | ||
ELB elbiface.ELBAPI |
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 we not be adding the ELBv2 interface here?
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.
It is not used anywhere in the updated code as far as I can recall, and to keep changes slim I didn’t add it here. Do you think this needs to be a part of the PR?
@@ -606,7 +606,7 @@ promote-images: $(KPROMO) $(YQ) | |||
|
|||
.PHONY: release-binaries | |||
release-binaries: $(GORELEASER) ## Builds only the binaries, not a release. | |||
$(GORELEASER) build --config $(GORELEASER_CONFIG) --snapshot --clean | |||
GOMAXPROCS=2 $(GORELEASER) build --config $(GORELEASER_CONFIG) --snapshot --clean |
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.
Change is unrelated – can we take this out?
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 don’t think so, this change fixes stuck goreleaser build in CI: #5518 (comment) I was able to reproduce it locally, and this change fixes it. Some other AWS SDK v2 rewrite PRs are affected by this too.
pkg/cloud/filterv2/types.go
Outdated
*/ | ||
|
||
// Package filterv2 contains the ec2 sdk v2 related filters. | ||
package filterv2 |
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.
Unused?
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.
If you refer to filterv2
in general, it is needed and used for example in https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/5518/files#diff-fb7618ec3e9301951d4d093fa53e72a5f8ee1ef919d4213dcf6f530125f800ecR29 I simply copied filter
package, the types.go
there is empty as well.
{ | ||
Key: aws.String("kubernetes.io/cluster/cluster1"), | ||
Key: aws.String("kubernetes.io/cluster/eks-test-cluster"), |
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 does the cluster name need to be changed in this test?
@@ -80,7 +80,8 @@ func (s *Service) deleteTargetGroups(ctx context.Context, resources []*AWSResour | |||
} | |||
|
|||
func (s *Service) isELBResourceToDelete(resource *AWSResource, resourceName string) bool { | |||
if !s.isMatchingResource(resource, elb.ServiceName, resourceName) { | |||
// Need to update this to use the v2 service name if it's different |
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.
Is this a TODO? It's unclear what needs to be done / what's left to do. Which v2 (ELBv2 or AWS SDK Go v2), ...?
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.
V2 packages stopped using ServiceName
variables. I think this can be removed though.
@@ -134,14 +135,17 @@ func (s *Service) deleteTargetGroup(ctx context.Context, targetGroupARN string) | |||
// describeLoadBalancers gets all elastic LBs. | |||
func (s *Service) describeLoadBalancers(ctx context.Context) ([]string, error) { | |||
var names []string | |||
err := s.elbClient.DescribeLoadBalancersPagesWithContext(ctx, &elb.DescribeLoadBalancersInput{}, func(r *elb.DescribeLoadBalancersOutput, last bool) bool { | |||
for _, lb := range r.LoadBalancerDescriptions { | |||
// AWS SDK v2 does not have PagesWithContext, need to use paginator |
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.
Comment can be removed since we get the context timeout functionality via NextPage(ctx)
c2c6a4d
to
5012b2c
Compare
New changes are detected. LGTM label has been removed. |
Signed-off-by: Danil-Grigorev <[email protected]>
5012b2c
to
8ee8a1e
Compare
@Danil-Grigorev: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Migrate ELB garbage collection to AWS SDK v2
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #5406
Special notes for your reviewer:
Checklist:
Release note: