cmdline: add support for loading config from a local device#2230
cmdline: add support for loading config from a local device#2230atd9876 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces support for loading Ignition configurations from a local device on bare metal platforms via the ignition.config.device and ignition.config.path kernel parameters. The implementation includes documentation updates, a refactored command-line parser, and logic to mount the specified device and read the configuration file. Review feedback identifies a potential logic error where returning configErrors.ErrEmpty might cause a fatal failure instead of a fallback when a device is missing, and a path traversal vulnerability when accessing the configuration file on the mounted device.
bab4a01 to
a13e77b
Compare
prestist
left a comment
There was a problem hiding this comment.
This is looking good overall, thank you for working on this! Some small comments.
I think we could use some integration tests, I would add a blackbox test (in tests/positive/) that sets up a labeled disk image with a config file and boots with ignition.config.device=LABEL ignition.config.path=/config.ign, wdyt?
prestist
left a comment
There was a problem hiding this comment.
Just two comments, Im not sure how I feel about them. What are your thoughts?
|
Thanks for the updates in A couple of things I'd like addressed before we merge:
Lastly the "Require release note" CI check is failing -- can you add a release note? |
|
I will fix those issues. Re the
|
9a073d5 to
0861cdd
Compare
|
@atd9876 Okay from my perspective this is lgtm, just need to rebase and resolve any commits to get the CI working :) |
0861cdd to
06a1302
Compare
Follow the existing pattern used by SystemConfigDir and other distro functions, allowing KernelCmdlinePath to be overridden via the IGNITION_KERNEL_CMDLINE_PATH environment variable. This enables blackbox tests to inject a fake kernel cmdline. Signed-off-by: Andrew Dodds <andrew.dodds@sap.com>
Add support for loading Ignition config from a labeled block device via the ignition.config.device and ignition.config.path kernel command-line arguments. Both must be specified together. Error handling: - Return hard error if only one of device/path is specified - Return hard error if the device does not appear within 30s timeout - Return hard error if the config file is not found on the device Includes unit tests for parseCmdline and blackbox integration tests covering both positive (successful fetch) and negative (missing device, missing file, incomplete options) scenarios. Signed-off-by: Andrew Dodds <andrew.dodds@sap.com>
06a1302 to
feb4f08
Compare
Summary
Add support for loading Ignition configuration from a local device
specified via kernel command-line flags
ignition.config.deviceandignition.config.path. This enables bare-metal and air-gappedenvironments to provide Ignition configs on a labeled disk partition
(e.g., a config drive) without requiring network access.
Acknowledgments
The initial device-based config loading implementation (commit 6c250bc)
was authored by Jan Larwig (@tuunit). This PR builds on that work with
tests, documentation, and robustness improvements.
Changes
parseCmdlinenow recognizesignition.config.deviceandignition.config.pathflags.fetchConfiguses both to mount the labeled device read-only andread the config file at the specified path.
tryMountingfunction: Waits for the labeled device to appear(with a 30-second timeout), mounts it read-only into a temporary
directory, reads the config, and unmounts on return.
parseCmdline:strings.Fieldsinstead ofstrings.Splitto correctlyhandle tabs, multiple spaces, and trailing newlines.
urlvariable toparsedURLto avoid shadowingthe
net/urlimport.errors.Is(err, context.DeadlineExceeded)instead of==to correctly match wrapped errors.
partial flags, empty flags, invalid URLs, precedence,
fileExists,and error handling in test helpers.
Fixes #2207