Skip to content

feat(eni): add IPStatusInvalid and update status handling for invalid…#942

Merged
BSWANG merged 1 commit intoAliyunContainerService:mainfrom
l1b0k:feat/enahnce
Nov 25, 2025
Merged

feat(eni): add IPStatusInvalid and update status handling for invalid…#942
BSWANG merged 1 commit intoAliyunContainerService:mainfrom
l1b0k:feat/enahnce

Conversation

@l1b0k
Copy link
Copy Markdown
Collaborator

@l1b0k l1b0k commented Nov 25, 2025

… IPs


Note

Introduce Invalid IP status and update ENI sync/release logic to mark in-use missing IPs invalid, keep primary IPs, and transition invalid IPs to deleting; bump Node CRD to v0.6.1.

  • API/CRDs:
    • Add Invalid to IP status enum in pkg/apis/crds/network.alibabacloud.com_nodes.yaml (IPv4/IPv6).
    • Bump CRDNode version to v0.6.1 in pkg/apis/crds/register.go.
    • Define IPStatusInvalid in pkg/apis/network.alibabacloud.com/v1beta1/node_types.go and update validation enum.
  • Controller (multi-ip node):
    • mergeIPMap: preserve primary IPs missing from remote; mark in-use missing IPs as Invalid; delete others.
    • releasePodNotFound: transition non-primary Invalid IPs to Deleting when pod is released.
    • Tests: add cases for in-use missing IPs marked Invalid and primary IP preservation.

Written by Cursor Bugbot for commit 5465d9e. This will update automatically on new commits. Configure here.

… IPs

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

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 21

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Bug: Invalid IPs assigned in takeover case

The takeover logic assigns IPs to pods without checking the IP status. This allows pods to be assigned IPs with IPStatusInvalid or IPStatusDeleting status, which could be non-functional or in the process of being removed. The normal assignment flow at lines 722 and 767 correctly filters for IPStatusValid, but the takeover case at lines 676-680 and 689-693 lacks this validation, creating an inconsistency that could assign invalid IPs to pods.

pkg/controller/multi-ip/node/pool.go#L675-L680

eniIP, ok := ipv4Map[info.IPv4]
if ok && (eniIP.IP.PodID == "" || eniIP.IP.PodID == podID) {
info.ipv4Ref = eniIP
eniIP.IP.PodID = podID
eniIP.IP.PodUID = info.PodUID
log.Info("assign ip (from pod status)", "pod", podID, "ip", eniIP.IP, "eni", eniIP.NetworkInterface.ID)

pkg/controller/multi-ip/node/pool.go#L688-L693

eniIP, ok := ipv6Map[info.IPv6]
if ok && (eniIP.IP.PodID == "" || eniIP.IP.PodID == podID) {
info.ipv6Ref = eniIP
eniIP.IP.PodID = podID
eniIP.IP.PodUID = info.PodUID
log.Info("assign ip (from pod status)", "pod", podID, "ip", eniIP.IP, "eni", eniIP.NetworkInterface.ID)

Fix in Cursor Fix in Web


@codecov
Copy link
Copy Markdown

codecov bot commented Nov 25, 2025

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.77%. Comparing base (fe8cdd8) to head (5465d9e).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/multi-ip/node/pool.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #942      +/-   ##
==========================================
+ Coverage   61.76%   61.77%   +0.01%     
==========================================
  Files         131      131              
  Lines       16096    16106      +10     
==========================================
+ Hits         9942     9950       +8     
- Misses       4980     4983       +3     
+ Partials     1174     1173       -1     
Flag Coverage Δ
unittests 61.77% <83.33%> (+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 merged commit 3cb5ea2 into AliyunContainerService:main Nov 25, 2025
10 checks passed
@l1b0k l1b0k deleted the feat/enahnce branch November 25, 2025 08:06
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.

2 participants