Skip to content

✨ introduce preprovisioningKernelParams to BMH#2576

Open
Rozzii wants to merge 1 commit intometal3-io:mainfrom
Nordix:node_spec_kern_args
Open

✨ introduce preprovisioningKernelParams to BMH#2576
Rozzii wants to merge 1 commit intometal3-io:mainfrom
Nordix:node_spec_kern_args

Conversation

@Rozzii
Copy link
Copy Markdown
Member

@Rozzii Rozzii commented Jul 21, 2025

This PR:

  • Implements support for additional kernel parameters during preprovisioning
  • Adds PreprovisioningExtraKernelParams spec field to BareMetalHost CRD
  • Implements kernel parameter combination logic between BMH and PreprovisioningImage CRs
  • Adds comprehensive unit tests for parameter combination scenarios
  • Renames getInstanceUpdateOpts to getProvisioningInstanceUpdateOptsForNode for consistency
  • Updates BMC access utilities to support extra kernel parameters
  • Adds PreprovisioningExtraKernelParams field to ManagementAccessData struct
    for provisioner interface
  • Extends kernel extra preprov param handling to account for different preprov
    image scenarios (external initrd, external iso, self made PPI, unknown format, no PPI)
  • Adds ownership detection logic to distinguish external vs BMO-managed PreprovisioningImages
  • Adds BMO internal defaultPPImgFormat constant for internal BMO-managed PPI identification
  • Extends default PPI provider and reconciler to handle extraKernelParams

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

Other info:

@metal3-io-bot metal3-io-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 21, 2025
@metal3-io-bot metal3-io-bot requested review from elfosardo and honza July 21, 2025 12:50
@metal3-io-bot metal3-io-bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jul 21, 2025
@Rozzii Rozzii moved this to BMO WIP in Metal3 - Roadmap Jul 21, 2025
@Rozzii Rozzii added this to the BMO - v0.11 milestone Jul 21, 2025
@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Jul 21, 2025

/retest

@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Jul 23, 2025

/ok-to-test

@metal3-io-bot metal3-io-bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jul 23, 2025
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from 88beeae to 5322972 Compare July 23, 2025 10:31
@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Jul 23, 2025

@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.

@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Jul 23, 2025

/cc @dtantsur

@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Aug 13, 2025

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.

@Rozzii Rozzii changed the title WIP ✨ introduce preprovisioningKernelParams to BMH ✨ introduce preprovisioningKernelParams to BMH Aug 14, 2025
@metal3-io-bot metal3-io-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 14, 2025
@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Aug 14, 2025

/cc @fmuyassarov @lentzi90

@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Aug 14, 2025

/cc @kashifest
FYI

@kashifest
Copy link
Copy Markdown
Member

/cc @zaneb @dtantsur

@metal3-io-bot metal3-io-bot requested a review from zaneb August 14, 2025 19:37
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from 82c2e16 to 9b51b3e Compare January 29, 2026 09:56
@metal3-io-bot metal3-io-bot removed the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Jan 29, 2026
@metal3-io-bot metal3-io-bot added the needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. label Feb 19, 2026
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from 9b51b3e to f50616e Compare March 18, 2026 13:11
@metal3-io-bot
Copy link
Copy Markdown
Contributor

metal3-io-bot commented Mar 18, 2026

@Rozzii: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
markdownlint 82c2e16 link true /test markdownlint
test 82c2e16 link true /test test
shellcheck 82c2e16 link true /test shellcheck

Full PR test history. Your PR dashboard.

Details

Instructions 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.

@Rozzii Rozzii force-pushed the node_spec_kern_args branch from f50616e to 8126b0a Compare March 18, 2026 13:12
@metal3-io-bot metal3-io-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates that a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Mar 18, 2026
@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Mar 18, 2026

/hold
I am still working on the refactoring.

@metal3-io-bot metal3-io-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 18, 2026
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from 8126b0a to f82b0e0 Compare March 18, 2026 19:59
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from f82b0e0 to bd23be7 Compare April 16, 2026 09:21
@metal3-io-bot metal3-io-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 16, 2026
@Rozzii Rozzii force-pushed the node_spec_kern_args branch 2 times, most recently from f447d3c to 9f0e183 Compare April 17, 2026 13:05
@Rozzii
Copy link
Copy Markdown
Member Author

Rozzii commented Apr 18, 2026

/hold cancel

@metal3-io-bot metal3-io-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 18, 2026
@tuminoid tuminoid requested a review from Copilot April 19, 2026 16:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.preprovisioningExtraKernelParams to the BMH API/CRDs and propagate it via ManagementAccessData.
  • Update Ironic provisioning to format/apply extra preprovisioning kernel params (kernel_append_params) and adjust BMC access DriverInfo signatures 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.

Comment thread internal/controller/metal3.io/baremetalhost_controller.go Outdated
Comment thread internal/controller/metal3.io/baremetalhost_controller.go Outdated
Comment thread internal/controller/metal3.io/baremetalhost_controller.go Outdated
Comment thread pkg/provisioner/ironic/ironic.go Outdated
Comment thread config/base/crds/bases/metal3.io_baremetalhosts.yaml Outdated
Comment thread internal/controller/metal3.io/preprovisioningimage_controller.go Outdated
Comment thread pkg/provisioner/ironic/register.go
Comment thread pkg/provisioner/ironic/ironic.go Outdated
Comment thread apis/metal3.io/v1alpha1/baremetalhost_types.go Outdated
Comment thread internal/controller/metal3.io/preprovisioningimage_controller.go
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from 9f0e183 to a743279 Compare April 21, 2026 18:31
@metal3-io-bot metal3-io-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 21, 2026
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from a743279 to 45d368d Compare April 21, 2026 20:12
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>
@Rozzii Rozzii force-pushed the node_spec_kern_args branch from 45d368d to 7cdcfb5 Compare April 22, 2026 05:58
{
name: "params with leading/trailing spaces",
input: " console=ttyS0 debug=1 ",
expected: defaultKernelParam + " console=ttyS0 debug=1 ",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we trim the extra spaces?

Copy link
Copy Markdown
Member Author

@Rozzii Rozzii Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we return the trimmed params instead of the original?

Suggested change
return defaultKernelParam + " " + params
return defaultKernelParam + " " + trimmedParams

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same is above, not mandatory but we can trim them I am not against that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines +115 to +116
// HasFirmwareSpec True if any firmware spec exists (settings, components, or
// legacy FirmwareConfig), used to distinguish "no updates" from "user cleared spec".
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment makes more sense where it was I think

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have preprovImg up on line 923 that we could pass in here. That way we can skip the getPreprovImage call in retrievePreprovisioningExtraKernelParamsSpec.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense, I will check how big of a change that would be .

bmcType string
hostname string
disableCertificateVerification bool
driverInfo string
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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{}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to change DriverInfo? I saw there was a comment before about this but I didn't get the conclusion.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

Status: BMO WIP

Development

Successfully merging this pull request may close these issues.

6 participants