-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add /usr/lib/bootc/kargs.d
support
#401
add /usr/lib/bootc/kargs.d
support
#401
Conversation
/usr/lib/bootc/kargs.d
support
30f8e66
to
b5a9e5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking at this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marking as needs-work based on https://github.com/containers/bootc/pull/401/files#r1529248230
b5a9e5b
to
c31108a
Compare
c31108a
to
4e0e48d
Compare
Let's bikeshed some of the file format/semantics. One angle: I think there are use cases for conditionally-applied kernel arguments. One that very much comes up is the IOW
maybe? BTW, a whole thing running through all of this is that I think a number of bootc use cases are better off actually generating custom kernel binaries, where you don't need or want this at all; that's something to keep in mind. |
@cgwalters Do you know if there's there a way for Rust to detect what platform your system is running? I'm able to find and match against the arch of the system using |
There's a bunch of things you can trigger conditional compilation on, such as target_os, maybe that can cover what you need? |
By "platform" I meant e.g. AWS vs GCP vs OpenStack etc. We're not going to build distinct bootc binaries for each of those, and runtime detection is "interesting". What Fedora CoreOS and derivatives do is https://github.com/coreos/fedora-coreos-tracker/blob/main/internals/README-internals.md#ignitionplatformid At a practical level though I think we will likely end up with distinct container builds per "platform" in this sense, so we probably don't need to do dynamic dispatch here. That said, for base images that do include ignition they'll need to have |
Ah gotcha. That's what I get for not reading back far enough for context. Carry on! |
It's a bit ugly but we could also consider matching what Cargo does for architecture conditionals... https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies Maybe even lift the code. Dunno. I think my instinct here is that anything we do with kargs we should do with install configs too, as that's also a made up TOML thing but we may as well try to be consistent. Specifically it makes sense to me to support "install only" kargs having architecture conditionals too. |
6b2f0fc
to
e4acb9f
Compare
398b24c
to
fc170bb
Compare
I guess a downside of using the modules directory (aka So...I don't have anything better than |
➡️ https://groups.google.com/a/opencontainers.org/g/dev/c/OtLlhn4jxBg |
Required for containers#401 Adds a `EnvProperties` struct to allow for conditional merging of kargs depending on whether the archiecture matches. Future properties such as `platform.id` can be added in the future. Signed-off-by: Luke Yang <[email protected]>
Required for containers#401 Adds a `EnvProperties` struct to allow for conditional merging of kargs depending on whether the archiecture matches. Future properties such as `platform.id` can be added in the future. Signed-off-by: Luke Yang <[email protected]>
Required for containers#401 Adds a `EnvProperties` struct to allow for conditional merging of kargs depending on whether the archiecture matches. Future properties such as `platform.id` can be added in the future. Signed-off-by: Luke Yang <[email protected]>
Required for containers#401 Adds a `EnvProperties` struct to allow for conditional merging of kargs depending on whether the archiecture matches. Future properties such as `platform.id` can be added in the future. Signed-off-by: Luke Yang <[email protected]>
34d7cd4
to
a862e9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I think this is generally looking good; the big gap I see is around integration testing. I'd hoped to be able to give you better guidance and tooling here by now. We'll continue to track that in #543
Short term, I think we can probably merge, and e.g. @henrywang can look at updating the integration tests there.
We're also going to need changes to the docs.
Can you also take an action item to do a merge request to https://gitlab.com/fedora/bootc/examples say?
// Get the running kargs of the booted system | ||
if let Some(bootconfig) = ostree::Deployment::bootconfig(booted_deployment) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks correct, though I would say we should probably add a convenience helper to this in ostree.
a862e9e
to
3768c05
Compare
Oh sorry, I was going to look at this but it slipped my mind. I can probably have a crack at it to see if I can get it working. If I can't see to get it, I'll probably reach out to @henrywang.
Will do. |
MR updating bootc examples: https://gitlab.com/fedora/bootc/examples/-/merge_requests/48 |
3768c05
to
6a2c29d
Compare
I tested this out and hit:
|
lib/src/kargs.rs
Outdated
.downcast::<ostree::RepoFile>() | ||
.expect("downcast"); | ||
if !fetched_tree.query_exists(cancellable) { | ||
return Ok(Default::default()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also hit on the fact that my test machine didn't come up across an update, and I think this is the cause: this must be return Ok(existing_kargs);
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be
kargs.append(&mut existing_kargs);
return Ok(kargs);
Since the kargs
vec contains the existing kargs on the running system.
6a2c29d
to
d002e2a
Compare
Fixes containers#255. Allows users to create files within /usr/lib/bootc/kargs.d with kernel arguments. These arguments can now be applied on a switch, upgrade, or edit. General process: - use ostree commit of fetched container image to return the file tree - navigate to /usr/lib/bootc/kargs.d - read each file within the directory - calculate the diff between the booted and fetched kargs in kargs.d - apply the diff to the kargs currently on the running system - pass the kargs to the stage() function Signed-off-by: Luke Yang <[email protected]>
d002e2a
to
0d185b4
Compare
Fixes #255. Allows users to create files within
/usr/lib/bootc/kargs.d
with kernel arguments. These arguments can now be applied on a switch, upgrade, or edit.General process:
Example Containerfile:
Looking for some input as to how files within
/usr/lib/bootc/kargs.d
should be formatted (which will also affect how the contents of the file are parsed)Signed-off-by: Luke Yang [email protected]