- 
                Notifications
    You must be signed in to change notification settings 
- Fork 60
BlueprintBuilder: require caller to provide internal DNS subnet #9250
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
base: main
Are you sure you want to change the base?
Conversation
This is part of #9238: we'd like to pull `BlueprintResourceAllocator`'s weird construction out of `BlueprintBuilder`, and this removes _one_ use of it. When adding an internal DNS zone, the caller must now specify the `DnsSubet` instead of `BlueprintBuilder` choosing internally. To assist with this, adds `BlueprintBuilder::available_internal_dns_subnets()`, which returns an iterator of available subnets. I'm not sure this is the right interface; will leave a comment inline with some other ideas.
| .map(|(_sled_id, resources)| resources.subnet) | ||
| .next() | ||
| .ok_or(Error::RackSubnetUnknownNoSleds)?; | ||
| let rack_subnet = ReservedRackSubnet::from_subnet(any_sled_subnet); | 
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.
This is the part I like the least. Some alternatives I considered:
- Instead of available_internal_dns_subnets(), provideinternal_dns_subnets_in_use(), and require the caller to do this work and the filtering we do based on it below. This seems the most true to a "dumb builder" pattern, but puts some annoying work on every caller.
- Instead of returning an error on line 713, return an empty iterator if we don't have any commissioned sleds.
- A mix of 1 and 2: instead of returning a raw iterator, return an AvailableInternalDnsSubnetstype that is more like theInternalDnsSubnetAllocatorremoved in this PR: internally it only tracks the "in use" subnets, and requires the caller to pass in a sled subnet (from which we can derive a rack subnet and the set of possible DNS subnets).
Do any of these seem more likely to put us in a better position w.r.t. multirack? (How will internal DNS subnets be configured in multirack?)
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.
The approach you've got here seems fine to me for now!
| .map(|(_sled_id, resources)| resources.subnet) | ||
| .next() | ||
| .ok_or(Error::RackSubnetUnknownNoSleds)?; | ||
| let rack_subnet = ReservedRackSubnet::from_subnet(any_sled_subnet); | 
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.
The approach you've got here seems fine to me for now!
This is part of #9238: we'd like to pull
BlueprintResourceAllocator's weird construction out ofBlueprintBuilder, and this removes one use of it. When adding an internal DNS zone, the caller must now specify theDnsSubetinstead ofBlueprintBuilderchoosing internally.To assist with this, adds
BlueprintBuilder::available_internal_dns_subnets(), which returns an iterator of available subnets. I'm not sure this is the right interface; will leave a comment inline with some other ideas.