-
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
Refactor aws cloud service and introduce a client provider #3895
Refactor aws cloud service and introduce a client provider #3895
Conversation
0b2deac
to
78f7edc
Compare
/test pull-aws-load-balancer-controller-e2e-test |
return p.ec2Client, nil | ||
} | ||
|
||
func (p *defaultAWSClientsProvider) GetELBV2Client(ctx context.Context, operationName string) (*elasticloadbalancingv2.Client, 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.
nit: let's change to GetELBv2Client to be consistent with GetWAFv2Client
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 the typo, thanks
pkg/aws/services/ec2.go
Outdated
@@ -112,7 +126,11 @@ func (c *ec2Client) DescribeSubnetsAsList(ctx context.Context, input *ec2.Descri | |||
|
|||
func (c *ec2Client) DescribeVPCsAsList(ctx context.Context, input *ec2.DescribeVpcsInput) ([]types.Vpc, error) { | |||
var result []types.Vpc | |||
paginator := ec2.NewDescribeVpcsPaginator(c.ec2Client, input) | |||
client, err := c.awsClientsProvider.GetEC2Client(ctx, "DescribeVPCs") |
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.
for the passed-in "operationName", let's use the real AWS operation name. You can find it in the generated SDK:
https://github.com/aws/aws-sdk-go-v2/blob/f8631c3fcf531450411deb514e5d5a18e93824f0/service/ec2/api_op_DescribeVpcs.go#L27
e.g. it shall be DescribeVpcs
instead of DescribeVPCs
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
b2d8753
to
2399e84
Compare
2399e84
to
f128f28
Compare
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
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: M00nF1sh, oliviassss 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 |
f128f28
to
284664d
Compare
New changes are detected. LGTM label has been removed. |
Issue
Description
This PR refactors the aws cloud services by introducing an
awsClientsProvider
. For this open-source controller, it just retains the current behavior, which is having a single client for all services. The refactor is needed mainly for internal usage where we have a controller that may have multiple clients per service, and we have an awsClientsProvider there to choose the proper client for each operation dynamically.Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯