Skip to content
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

cache ELB resource tags to reduce API calls #3550

Merged
merged 1 commit into from Feb 6, 2024

Conversation

M00nF1sh
Copy link
Collaborator

@M00nF1sh M00nF1sh commented Feb 1, 2024

Issue

Description

Backgroud:
By default, during reconcile for a Ingress/Service, the controller will need to find the ALB/NLB created for Ingress/Service. It achieves it by looking for ALB/NLB tagged with certain tags. However, the ELBv2 API don't support filter ALB/NLB with certain tags, thus we have to list all ALB/NLB in VPC and then list the tags on each of them. This is inefficient when there is large number of ALB/NLBs in vpc.
Note, there is a optional feature that uses RGT API, which supports directly filter ALB/NLB with certain tags, however that API requires internet access and not suitable for private clusters.

Changes done:
This PR will

  1. cache the ELB resource tags to reduce API calls. The cache for certain resource will expire after 20 mins and will be invalidated when the tags were mutated by controller.
  2. share the same ELBv2TaggingManager for Ingress/Service's modelBuilder & modelDeployer to reuse cache.

Checklist

  • Added tests that cover your change (if possible)
  • Added/modified documentation as required (such as the README.md, or the docs directory)
  • Manually tested
  • Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯

  • Backfilled missing tests for code in same general area 🎉
  • Refactored something and made the world a better place 🌟

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 1, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 1, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (ed00c81) 55.28% compared to head (078799d) 55.35%.

Files Patch % Lines
pkg/deploy/elbv2/tagging_manager.go 77.77% 5 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3550      +/-   ##
==========================================
+ Coverage   55.28%   55.35%   +0.07%     
==========================================
  Files         149      149              
  Lines        8950     8971      +21     
==========================================
+ Hits         4948     4966      +18     
- Misses       3664     3666       +2     
- Partials      338      339       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@oliviassss oliviassss added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Feb 6, 2024
@oliviassss
Copy link
Collaborator

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 6, 2024
@k8s-ci-robot
Copy link
Contributor

[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:
  • OWNERS [M00nF1sh,oliviassss]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit c77b6eb into kubernetes-sigs:main Feb 6, 2024
9 checks passed
oliviassss pushed a commit to oliviassss/aws-load-balancer-controller that referenced this pull request Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants