cluster-api-provider-tinkerbell
cluster-api-provider-tinkerbell copied to clipboard
feat: Add IPAM integration
This pull request introduces dynamic IP address allocation for Tinkerbell machines by integrating with Cluster API IPAM providers. The changes add support for specifying an IPAM pool in the machine spec, automatically creating and managing IP address claims, updating hardware resources with allocated IPs, and cleaning up claims on deletion. Comprehensive unit tests for the new IPAM logic have also been added.
IPAM integration and dynamic IP allocation:
- Added the
IPAMPoolReffield to theTinkerbellMachineSpec, allowing users to specify an IPAM pool for dynamic IP address allocation. - Implemented the IPAM workflow in
controller/machine/ipam.go, including logic for creating IP address claims, updating hardware with allocated IPs, and cleaning up claims.
Controller logic enhancements:
- Updated the machine reconciliation logic in
scope.goto handle IPAM pool configuration, trigger IP allocation, and update hardware resources accordingly. - Enhanced machine deletion logic to remove the associated
IPAddressClaimif IPAM was configured, ensuring proper resource cleanup. [1] [2]
Testing improvements:
- Added unit tests in
ipam_test.goto cover netmask conversion, hardware patching, and IPAM pool reference extraction, improving reliability and maintainability of the new IPAM logic.## Description
Fixes: #
How Has This Been Tested?
How are existing users impacted? What migration steps/scripts do we need?
Checklist:
I have:
- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
Thanks for this, @appkins. I actually tried to use
kobut i couldn't get it to allow overwriting the registry. I'd also prefer the changes to the build and release process be a separate PR. I'll start reviewing the rest of the PR. Thanks again for this!
All ko related changes are removed and will be in a new PR shortly.
Hey @appkins, I tried running this with the CAPT playground and got a bunch of nil pointer errors. I threw in some fixes for nil values but then ended up with errors around failed to ensure hardware: failed to reconcile IPAM: IPAddressClaim is nil. Have you been able to run this? Maybe I'm just doing something wrong.