-
Notifications
You must be signed in to change notification settings - Fork 254
fix: remove veth pair in vm ns if previously leaked and fix validation #3940
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
fix: remove veth pair in vm ns if previously leaked and fix validation #3940
Conversation
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
33e3145
to
4db2645
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this 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 fixes issues in transparent-vlan mode by proactively cleaning up leaked veth interfaces and improving validation error messages. The changes prevent network setup failures caused by stale veth pairs that may exist in the wrong namespaces.
- Adds proactive cleanup of vnet and container veth interfaces before creating new veth pairs
- Fixes validation logic to check the correct interface name in the correct namespace
- Updates error messages to be more descriptive and consistent throughout the codebase
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
network/transparent_vlan_endpointclient_linux.go | Adds cleanup function for leaked interfaces, fixes validation parameters, and updates error messages |
network/transparent_vlan_endpointclient_linux_test.go | Updates test cases to reflect new validation function signature and improved error messages |
network/networkutils/networkutils_linux.go | Adds interface name to logging for better debugging |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]> Signed-off-by: Alexander <[email protected]>
/azp run Azure Container Networking PR |
Azure Pipelines successfully started running 1 pipeline(s). |
Reason for Change:
In transparent-vlan mode, removes the vnet veth interface and container veth interface in the vm namespace if they exist prior to creating the pair in the vm namespace. This won't disrupt existing connections because these pairs are one per container, and if either side of the veth pair were in the vm namespace, the container's networking would be broken. The vnet veth interface must be in the vnet namespace and the container veth interface must be in the container namespace in a working setup (otherwise it is broken and we need to clean up). Removing one side of the veth should remove the other.
The above shouldn't be necessary since we already validate the existence of the veth interfaces on ADD, but it seems like sometimes the veth creation can pass validation, but then disappear for a short period of time before re-appearing, bypassing the cleanup logic during the add.
Also fixes an improper validation check after moving the vnet veth into the vnet namespace (though this did not cause the issue that triggered this fix). Previously it would check the wrong interface name, now it will check the interface name passed in the namespace passed in.
Issue Fixed:
See above
Requirements:
Notes:
Tested on a multitenancy linux transparent vlan setup with no issues
0c99864, consolidate logic and improve uts