fix: properly allocate adjacent single address external subnets#10747
Open
sudomateo wants to merge 2 commits into
Open
fix: properly allocate adjacent single address external subnets#10747sudomateo wants to merge 2 commits into
sudomateo wants to merge 2 commits into
Conversation
Added a regression test that shows subnet pools fail to allocate adjacent single address subnets (e.g., /32, /128).
bc26e9f to
2a80381
Compare
Contributor
Author
|
I'll continue this tomorrow. Just wanted to get this test pushed to show that the current code is broken in this case. |
Updated the database logic to properly allow allocation of adjacent single address external subnets (e.g., /32, /128). Closes #10748.
sudomateo
commented
Jul 6, 2026
Comment on lines
+1302
to
+1317
| // Unique index names from `dbinit.sql`. CockroachDB reports these as the | ||
| // constraint name on a unique violation, allowing us to match against them for | ||
| // better error messaging. | ||
|
|
||
| /// Uniqueness of (`project_id`, `name`). | ||
| const EXTERNAL_SUBNET_NAME_CONSTRAINT: &str = | ||
| "external_subnet_project_id_name_key"; | ||
|
|
||
| /// Uniqueness of (`subnet`). | ||
| const EXTERNAL_SUBNET_SUBNET_CONSTRAINT: &str = | ||
| "lookup_external_subnet_by_subnet"; | ||
|
|
||
| /// Uniqueness of (`first_address`, `last_address`). | ||
| const EXTERNAL_SUBNET_ADDRESS_CONSTRAINT: &str = | ||
| "lookup_external_subnet_by_first_and_last_address"; | ||
|
|
Contributor
Author
There was a problem hiding this comment.
I don't love that these constants can get out of sync with what's in dbinit.sql but I didn't know how to tie them together. I do like the better error messaging they provide though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated the database logic to properly allow allocation of adjacent single address external subnets (e.g., /32, /128).
Closes #10748.