fix: handle server-ip-within-range case correctly #28
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.
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Problem:
Given an IPPool object with the following YAML:
The mutator will fill the missing
.spec.ipv4Config.serverIP
field, and since there's no router specified, the serverIP will be192.168.30.1
by default. However, that IP address is within the allocatable range (as the mutator-filled.spec.ipv4Config.pool.start
and.spec.ipv4Config.pool.end
fields will be192.168.30.1
and192.168.30.254
, respectively.) In the previous version, though the server IP address will be marked asRESERVED
under the.status.ipv4.allocated
field, it wasn't handled adequately by the webhook and controller:RESERVED
IP address the same way as allocated IP addresses. It will fail when validating any further updating requests because it thinks the server IP address is already occupied.RESERVED
IP addresses. They should be skipped just like how we did to the excluded IPs.Solution:
If the server IP is within the allocatable pool range, it will be marked as "RESERVED" and honored by the webhook and controller's cache-builder reconciliation loop.
Related Issue:
harvester/harvester#5225
Test plan:
harvester-vm-dhcp-controller
add-ontest-net
.spec.ipv4Config.serverIP
and marked asRESERVED
under.status.ipv4.allocated
test-net
VM Network.status.ipv4.allocated
fieldharvester-system/default-test-net-agent
is gone