Skip to content

perf(controller): optimize NetworkInterface CR handling with a map#909

Merged
BSWANG merged 1 commit intoAliyunContainerService:mainfrom
l1b0k:main
Sep 19, 2025
Merged

perf(controller): optimize NetworkInterface CR handling with a map#909
BSWANG merged 1 commit intoAliyunContainerService:mainfrom
l1b0k:main

Conversation

@l1b0k
Copy link
Collaborator

@l1b0k l1b0k commented Sep 18, 2025

  • List all existing NetworkInterface CRs to avoid multiple Get requests
  • Build a map for fast lookup
  • Use the map to check if a NetworkInterface CR exists before creation
  • Update the syncNetworkInterfaceCR function to use the existence check

- List all existing NetworkInterface CRs to avoid multiple Get requests
- Build a map for fast lookup
- Use the map to check if a NetworkInterface CR exists before creation
- Update the syncNetworkInterfaceCR function to use the existence check

Signed-off-by: l1b0k <libokang.lbk@alibaba-inc.com>
@codecov
Copy link

codecov bot commented Sep 18, 2025

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.41%. Comparing base (9dedc55) to head (5357a6c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/pod-eni/eni_controller.go 86.95% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #909   +/-   ##
=======================================
  Coverage   59.40%   59.41%           
=======================================
  Files         131      131           
  Lines       19543    19545    +2     
=======================================
+ Hits        11610    11612    +2     
  Misses       6784     6784           
  Partials     1149     1149           
Flag Coverage Δ
unittests 59.41% <86.95%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BSWANG BSWANG requested a review from Copilot September 19, 2025 02:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes NetworkInterface CR handling in the migration function by reducing API calls through efficient lookup patterns. Instead of making individual Get requests for each NetworkInterface CR, it lists all existing CRs once and builds a map for fast lookups.

  • Replace individual Get requests with a single List operation and map-based lookups
  • Modify syncNetworkInterfaceCR to accept an existence flag parameter
  • Streamline the CR creation/update logic by eliminating redundant API calls

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@BSWANG BSWANG merged commit b129720 into AliyunContainerService:main Sep 19, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants