fix(hostnetwork): protect externally managed bridges from deletion - #671
fix(hostnetwork): protect externally managed bridges from deletion#671maiqueb wants to merge 1 commit into
Conversation
deleteLinksForType extracts VNIs from bridge names and deletes bridges
whose VNI is not in the configured set. External bridges encode a
user-chosen number that differs from the L2VNI's actual VNI, causing
wrongful deletion. Thread externalBridges set (map[string]struct{})
from API-level L2VNIs through the cleanup chain so both Linux and OVS
paths skip bridges with External lifecycle. Drop the redundant OVS
created-by external ID. Make lifecycle immutable via CEL XValidation.
Assisted-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe change makes L2VNI bridge lifecycle immutable, passes configured external bridge names into VNI cleanup, preserves external Linux and OVS bridges, and adds coverage for preserved and automatically managed bridges. ChangesExternal bridge cleanup
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant host_config
participant RemoveNonConfiguredVNIs
participant LinuxBridgeCleanup
participant OVSBridgeCleanup
host_config->>host_config: collect configured external bridge names
host_config->>RemoveNonConfiguredVNIs: pass external bridge set
RemoveNonConfiguredVNIs->>LinuxBridgeCleanup: clean VNI links
LinuxBridgeCleanup-->>RemoveNonConfiguredVNIs: preserve matching external bridges
RemoveNonConfiguredVNIs->>OVSBridgeCleanup: clean VNI bridges
OVSBridgeCleanup-->>RemoveNonConfiguredVNIs: preserve matching external bridges
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Is this a BUG FIX or a FEATURE ?:
/kind bug
What this PR does / why we need it:
deleteLinksForType extracts VNIs from bridge names and deletes bridges whose VNI is not in the configured set. External bridges encode a user-chosen number that differs from the L2VNI's actual VNI, causing wrongful deletion. Thread externalBridges set (map[string]struct{}) from API-level L2VNIs through the cleanup chain so both Linux and OVS paths skip bridges with External lifecycle. Drop the redundant OVS created-by external ID. Make lifecycle immutable via CEL XValidation.
Special notes for your reviewer:
Fixes: #662
Release note:
AI Guidelines Acknowledgment:
Summary by CodeRabbit