✨ Add networkRanges to DHCP for multi-subnet support#553
✨ Add networkRanges to DHCP for multi-subnet support#553holmboe wants to merge 1 commit intometal3-io:mainfrom
Conversation
Add DHCPRange struct and NetworkRanges field to the DHCP CRD type, allowing multiple DHCP ranges for subnets served via relay agents. The operator concatenates all ranges into a semicolon-separated DHCP_RANGE env var. The primary flat fields remain supported for backward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Henrik Holmboe <henrik@dynamist.se>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @holmboe. Thanks for your PR. I'm waiting for a metal3-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
| NetworkCIDR string `json:"networkCIDR,omitempty"` | ||
|
|
||
| // RangeBegin is the first IP that can be given to hosts. Must be inside NetworkCIDR. | ||
| RangeBegin string `json:"rangeBegin,omitempty"` |
There was a problem hiding this comment.
How should we handle these fields? Does it make sense to call them deprecated and recommend using NetworkRanges?
| prefix, err := netip.ParsePrefix(dhcp.NetworkCIDR) | ||
| if err != nil { | ||
| return "" // don't disable your webhooks people | ||
| var parts []string |
There was a problem hiding this comment.
Please address the linter issue
| return err | ||
| // Validate primary range if present | ||
| if dhcp.RangeBegin != "" || dhcp.RangeEnd != "" { | ||
| if dhcp.NetworkCIDR == "" { |
There was a problem hiding this comment.
Could you find a way to reuse validateDHCPRange for the old fields? Maybe create a temporary NetworkRange variable.
Summary
DHCPRangestruct andNetworkRanges []DHCPRangefield to theDHCPCRD typenetworkRangesinto a single semicolon-separatedDHCP_RANGEenv varnetworkCIDR/rangeBegin/rangeEnd) are optional whennetworkRangesis providedCompanion PR
DHCP_RANGEon;and emit multipledhcp-range=linesTest plan
make testpasses — includes new validation andbuildDHCPRangetest casesnetworkRangesfieldnetworkRangesonly (no primary range) — validates new code pathnetworkRanges— verify semicolon-separatedDHCP_RANGE