-
Couldn't load subscription status.
- Fork 259
[CNS] Overlay Expansion Subnet Update Job Bug Fix #4103
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
Conversation
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 a bug in the overlay subnet expansion validation logic where IP addresses were being passed to validateCIDRSuperset without their prefix lengths, causing incorrect validation results. The fix ensures complete CIDR notation (IP/prefix) is provided to the validation function.
Key Changes:
- Fixed
validateCIDRSupersetcall to include prefix length in CIDR format - Updated test cases to use separate IP address and prefix length fields instead of combined CIDR strings
- Made test cases more comprehensive with varied prefix lengths
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| cns/restserver/internalapi.go | Fixed the validateCIDRSuperset call to properly format CIDR strings with prefix lengths |
| cns/restserver/internalapi_test.go | Refactored test cases to separate IP addresses from prefix lengths and added more comprehensive test scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@microsoft-github-policy-service agree company="Microsoft" |
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@microsoft-github-policy-service agree |
Reason for Change:
Previously, we called validateCIDRSuperset with only the IP address, which didn’t include the prefix length and resulted in incomplete CIDR notation, causing inaccurate superset validation for overlay subnet expansion.
For example, the function previously received just the IP address 10.240.0.0 instead of the full CIDR 10.240.0.0/24, which caused validateCIDRSuperset to read the logic inaccurately and led to incorrect subnet containment checks.
This happened because the IP and prefix length were stored separately in 2 different variables, and the code didn’t combine them before validation.
We considered explicitly building the CIDR string before validation. We chose to construct the full CIDR (IP/PrefixLength) for both the new and existing requests prior to calling validateCIDRSuperset, as this ensures correct subnet containment logic for subnet overlay expansion with minimal code change.
Issue Fixed:
Requirements:
Notes: