perf(controller): optimize NetworkInterface CR handling with a map#909
perf(controller): optimize NetworkInterface CR handling with a map#909BSWANG merged 1 commit intoAliyunContainerService:mainfrom
Conversation
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 Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.