Fix blueprint planner's validation of PlanningInput external networking#6599
Merged
Conversation
The "Check the planning input" block of code needs to consider _all_ zones in the parent blueprint, including expunged zones. #6483 fixed the planner's ability to reuse external IPs from expunged zones, but accidentally made these checks incorrect, because it's certainly valid for the planning input to still have records for expunged zones. See #6581 (comment) for more context. We also get to remove the somewhat-awkward update_network_resources_from_blueprint() test helper that was needed in #6483 to make some tests pass (because we didn't realize the checks being performed here were wrong).
davepacheco
approved these changes
Sep 18, 2024
| // Helper to validate that the system hasn't gone off the rails. There should | ||
| // never be any external networking resources in the planning input (which is | ||
| // derived from the contents of CRDB) that we don't know about from the parent | ||
| // blueprint. |
Collaborator
There was a problem hiding this comment.
I might say something explaining that this is possible, but means that our planning input has been invalidated, so the caller would be expected to take another lap.
| let zone_type = &z.zone_type; | ||
| match zone_type { | ||
| BlueprintZoneType::BoundaryNtp(ntp) => match ntp.nic.ip { | ||
| IpAddr::V4(ip) => { |
Collaborator
There was a problem hiding this comment.
Just a suggestion: could we make the sets contain IpAddr? That'd consolidate it into fewer sets and eliminate the matching.
edit: I see that would make the code below a little more complicated. I'll leave it to you to decide if it's any better on net.
Contributor
Author
There was a problem hiding this comment.
It's an improvement; the code below just needs some cheap .into()s (9ae92dc). Thanks!
plotnick
approved these changes
Sep 18, 2024
| } | ||
|
|
||
| #[track_caller] | ||
| pub fn assert_planning_makes_no_changes( |
jgallagher
added a commit
that referenced
this pull request
Oct 2, 2024
…rds (#6742) Recapping from the update sync: * #6483 moved the code restored by this PR into a helper method (`update_network_resources_from_blueprint()`), and also added calls to that method to a handful of tests to make them pass * In the external DNS work, we discovered that those tests should not have needed that, and the reason they did was because of a different bug * #6599 fixed that bug and removed `update_network_resources_from_blueprint()` and all its callers, but neglected to restore this code, meaning the `PlanningInput`s our tests create from their initial system descriptions never had any external networking records
hawkw
pushed a commit
that referenced
this pull request
Oct 2, 2024
…rds (#6742) Recapping from the update sync: * #6483 moved the code restored by this PR into a helper method (`update_network_resources_from_blueprint()`), and also added calls to that method to a handful of tests to make them pass * In the external DNS work, we discovered that those tests should not have needed that, and the reason they did was because of a different bug * #6599 fixed that bug and removed `update_network_resources_from_blueprint()` and all its callers, but neglected to restore this code, meaning the `PlanningInput`s our tests create from their initial system descriptions never had any external networking records
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.
The "Check the planning input" block of code needs to consider all zones in the parent blueprint, including expunged zones. #6483 fixed the planner's ability to reuse external IPs from expunged zones, but accidentally made these checks incorrect, because it's certainly valid for the planning input to still have records for expunged zones. See #6581 (comment) for more context.
We also get to remove the somewhat-awkward
update_network_resources_from_blueprint()test helper that was needed to make some tests pass (because we didn't realize the checks being performed here were wrong).