✨ introduce preprovisioningKernelParams to BMH#2576
✨ introduce preprovisioningKernelParams to BMH#2576Rozzii wants to merge 1 commit intometal3-io:mainfrom
Conversation
|
/retest |
078696a to
88beeae
Compare
|
/ok-to-test |
88beeae to
5322972
Compare
|
@dtantsur this is the initial idea based on the proposal, I am testing it manually , so far it worked I think I will add the e2e in a separate PR, but I think I need to add some unit testing still to this PR. |
|
/cc @dtantsur |
4516861 to
7ae19c9
Compare
|
I think the essential parts are there, I will push an e2e related PR as a followup but this is long enough as it is. Commits will be squashed if folks are okay with the implementation, but I will keep them separate for the time being. |
|
/cc @kashifest |
82c2e16 to
9b51b3e
Compare
9b51b3e to
f50616e
Compare
|
@Rozzii: The following tests failed, say
Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
f50616e to
8126b0a
Compare
|
/hold |
8126b0a to
f82b0e0
Compare
f82b0e0 to
bd23be7
Compare
f447d3c to
9f0e183
Compare
|
/hold cancel |
There was a problem hiding this comment.
Pull request overview
This PR adds support for passing extra kernel parameters to the preprovisioning agent by introducing a new optional preprovisioningExtraKernelParams field on the BareMetalHost API, plumbing it through the controller/provisioner layers, and extending Ironic driver-info updates and unit tests to cover parameter formatting/combination behavior.
Changes:
- Add
spec.preprovisioningExtraKernelParamsto the BMH API/CRDs and propagate it viaManagementAccessData. - Update Ironic provisioning to format/apply extra preprovisioning kernel params (
kernel_append_params) and adjust BMC accessDriverInfosignatures accordingly. - Add/extend controller logic and tests to locate the owning BMH for a PPI and to combine kernel params across BMH/PPI scenarios.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
apis/metal3.io/v1alpha1/baremetalhost_types.go |
Adds the new BMH spec field and its GoDoc. |
config/base/crds/bases/metal3.io_baremetalhosts.yaml |
Adds the new CRD schema field/description. |
config/render/capm3.yaml |
Adds the rendered CRD schema field/description. |
pkg/provisioner/provisioner.go |
Extends ManagementAccessData with PreprovisioningExtraKernelParams. |
internal/controller/metal3.io/baremetalhost_controller.go |
Adds reconciliation-time kernel param combination logic and passes it to the provisioner. |
internal/controller/metal3.io/baremetalhost_controller_test.go |
Adds unit tests for kernel param retrieval/combination scenarios. |
internal/controller/metal3.io/preprovisioningimage_controller.go |
Adds owner BMH lookup and mutates generated image kernel params for initrd. |
internal/controller/metal3.io/preprovisioningimage_controller_test.go |
Adds unit tests for findOwnerBMH. |
pkg/provisioner/ironic/ironic.go |
Adds kernel-param formatting helper, updates deploy-image logic, renames update-opts function. |
pkg/provisioner/ironic/register.go |
Passes formatted kernel params into BMC driver-info and adds conditional driver-info update logic. |
pkg/provisioner/ironic/register_test.go |
Updates deploy-image tests to use the new ManagementAccessData plumbing. |
pkg/provisioner/ironic/ironic_test.go |
Adds unit tests for fmtPreprovExtraKernParams. |
pkg/provisioner/ironic/provision_test.go |
Updates call sites for the renamed update-opts helper. |
pkg/provisioner/ironic/inspecthardware.go |
Adds an info log when node update does not start. |
pkg/provisioner/ironic/testbmc/testbmc.go |
Updates test BMC access driver-info to accept/publish kernel params. |
pkg/provisioner/ironic/prepare_test.go / pkg/provisioner/ironic/servicing_test.go |
Updates fake BMC implementations for the new DriverInfo signature. |
pkg/hardwareutils/bmc/access.go |
Changes AccessDetails.DriverInfo interface signature to include extra kernel params. |
pkg/hardwareutils/bmc/ipmi.go / redfish*.go / idrac_virtualmedia.go |
Adds kernel_append_params into driver-info maps. |
pkg/hardwareutils/bmc/access_test.go |
Updates expected driver-info maps and call signatures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9f0e183 to
a743279
Compare
a743279 to
45d368d
Compare
This commit: - Implements support for additional kernel parameters during preprovisioning - Add PreprovisioningExtraKernelParams spec field to BareMetalHost CRD - Implement kernel parameter combination logic between BMH and PreprovisioningImage CRs - Add comprehensive unit tests for parameter combination scenarios - Rename getInstanceUpdateOpts to getProvisioningInstanceUpdateOptsForNode for consistency - Update BMC access utilities to support extra kernel parameters - Add PreprovisioningExtraKernelParams field to ManagementAccessData struct for provisioner interface - Extend kernel extra preprov param handling to account for different preprov image scenarios (external initrd, external iso, self made PPI, unknown format, no PPI) - Add ownership detection logic to distinguish external vs BMO-managed PreprovisioningImages - Add BMO internal defaultPPImgFormat constant for internal BMO-managed PPI identification Notes: - The new spec field is optional and maintains backward compatibility - ISO format PreprovisioningImages ignore BMH kernel params with warning - In case of externally managed PreprovisioningImages with InitRD image format BMO will combine both BMH and PPI kernel params - Kernel parameters cannot be changed during fast-track deployments Signed-off-by: Adam Rozman <adam.rozman@est.tech>
45d368d to
7cdcfb5
Compare
| { | ||
| name: "params with leading/trailing spaces", | ||
| input: " console=ttyS0 debug=1 ", | ||
| expected: defaultKernelParam + " console=ttyS0 debug=1 ", |
There was a problem hiding this comment.
Shouldn't we trim the extra spaces?
There was a problem hiding this comment.
Kernel params are space separated, the number of spaces shouldn't matter. Current approach is that we do the absolute minimum modification to the params. (Basically only the concatenation) That said we can trim them I am not against it.
| return defaultKernelParam | ||
| } | ||
| // spacing matters for kernel params | ||
| return defaultKernelParam + " " + params |
There was a problem hiding this comment.
Shouldn't we return the trimmed params instead of the original?
| return defaultKernelParam + " " + params | |
| return defaultKernelParam + " " + trimmedParams |
There was a problem hiding this comment.
Same is above, not mandatory but we can trim them I am not against that.
There was a problem hiding this comment.
Ok, I think it would be nice to trim the "edges". This behavior of just trimming to see if it turns up empty is a bit surprising
| // HasFirmwareSpec True if any firmware spec exists (settings, components, or | ||
| // legacy FirmwareConfig), used to distinguish "no updates" from "user cleared spec". |
There was a problem hiding this comment.
The comment makes more sense where it was I think
There was a problem hiding this comment.
I did this because the linter started complaining, I might be doing something wrong but I was unable to shut up the golangci linter any other way.
| CurrentImage: getCurrentImage(info.host), | ||
| PreprovisioningImage: preprovImg, | ||
| PreprovisioningNetworkData: preprovisioningNetworkData, | ||
| PreprovisioningExtraKernelParams: r.retrievePreprovisioningExtraKernelParamsSpec(ctx, info, prov), |
There was a problem hiding this comment.
We have preprovImg up on line 923 that we could pass in here. That way we can skip the getPreprovImage call in retrievePreprovisioningExtraKernelParamsSpec.
There was a problem hiding this comment.
Yeah that makes sense, I will check how big of a change that would be .
| bmcType string | ||
| hostname string | ||
| disableCertificateVerification bool | ||
| driverInfo string |
There was a problem hiding this comment.
Do we need this? I don't see it used anywhere.
| // expected to add any other information that might be needed | ||
| // (such as the kernel and ramdisk locations). | ||
| DriverInfo(bmcCreds Credentials) map[string]interface{} | ||
| DriverInfo(bmcCreds Credentials, preprovExtraKernelArgs string) map[string]interface{} |
There was a problem hiding this comment.
Is it necessary to change DriverInfo? I saw there was a comment before about this but I didn't get the conclusion.
There was a problem hiding this comment.
It might be doable via instance info I am not sure about it, but we are already using driver info and we are updating driver info at every reconciliation if needed already.
Relation to the drivers:
If you check ironic-image you can see that in ironic.conf we are setting driver specific defaults for kernel params so I felt if we are manipulating these values on a driver level in ironic I would just follow along. In the previous comment it was pointed out that I am setting kernel params her https://github.com/metal3-io/baremetal-operator/pull/2576/changes/BASE..7cdcfb5cda0ae8b32e75dc645c4da18bd7defd65#diff-f05fc4a0c9679815bc34bcef100c2a8d525688f2804a1128c5b9e1e575b76c29L326 but this also ends up setting the driver_info at the en off the call chain.
Granularity:
Might be that in the future there will be a driver that won't support kernel param injection on a per node basis or only with limitations, this injection is done differently for different drivers on the provisioner level. An other thing is that we are representing/mirroring the ironic dirver_info in BMO for supported drivers already so I thought why not just extend the BMO representation of the driver_info with what we have on the ironic side anyways.
This PR:
for provisioner interface
image scenarios (external initrd, external iso, self made PPI, unknown format, no PPI)
Notes:
BMO will combine both BMH and PPI kernel params
Other info: