-
Notifications
You must be signed in to change notification settings - Fork 148
Add bootc internals cfs #1477
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 bootc internals cfs #1477
Conversation
Split into a few separate crates:
- libraries:
- composefs
- composefs-oci
- composefs-boot
- binaries:
- cfsctl
- composefs-setup-root
- erofs-debug
Move our lint config (which only forbids missing debug impls) to the
workspace level and have all crates inherit from that.
Add a new workflow for testing that we can `cargo package` everything.
We need a nightly cargo in order to do this with workspaces containing
inter-dependent crates: rust-lang/cargo#13947
Make 'oci' an optional feature of cfsctl, but enable it by default.
Adjust our rawhide bls example (which included --no-default-features) to
*not* disable that.
This is not a huge improvement in terms of compile speed, and it has
some drawbacks (like 'cargo run' no longer defaulting to cfsctl) but it
seems like the right step at this point. I want to start to add some
more experimental code without making it part of the main crate.
Signed-off-by: Allison Karlitskaya <[email protected]>
Grub needs absolute paths to initrd and vmlinuz if we do not have `/boot` in a boot partition, which we do not in bootc. Add param `boot_subdir` which acts like a subdirectory in the boot directory in case the boot partition is mounted in another directory. Signed-off-by: Pragyan Poudyal <[email protected]>
It turns out that the information contained in splitstreams to assist
with garbage collection (ie: the list of things that we mustn't discard)
is exactly the required information for downloading (ie: the list of
things that we must acquire).
Use this fact to add support for fetching repository content from HTTP
servers. We only download the objects that are actually required, so
incremental pulls are very fast.
This works with just about any HTTP server, so you can do something like
python -m http.server -d ~/.var/lib/composefs
and download from that. With a fast enough web server on localhost,
pulling a complete image into an empty repository takes about as long as
pulling an `oci:` directory via skopeo with `cfsctl oci pull`.
In practice, this is intended to be used with a webserver which supports
static compression and pre-compressed objects stored on the server. In
particular, zstd support is enabled in the `reqwest` crate for this
reason, and it's working with something like:
find repo/objects/ -type f -name '*[0-9a-f]' -exec zstd -19 -v '{}' +
static-web-server -p 8888 --compression-static -d repo
There's also an included s3-uploader.py in the examples/ directory which
will upload a repository to an S3 bucket, with zstd compression.
Signed-off-by: Allison Karlitskaya <[email protected]>
Change the Repository::mount() API to return the mounted filesystem as an fd rather than taking the mountpoint as an argument. Create a new mount_at() API to replace the old one, replacing the canicalize() and mount_at() calls that used to be in mount_composefs_at(), which we remove. Update the various users. Making this change lets us simplify the logic in composefs-setup-root: it no longer has to manually open the image in order to perform the fsmount operation: it can use the new API on the repository. This allows us to make Repository::open_image() private, so do that too. Co-authored-by: Sanne Raymaekers <[email protected]> Signed-off-by: Allison Karlitskaya <[email protected]>
Allows cfsctl operations with fs-verity disabled. Signed-off-by: Sanne Raymaekers <[email protected]>
Supports writing `composefs=?<root-id>`. Signed-off-by: Sanne Raymaekers <[email protected]>
Signed-off-by: Pragyan Poudyal <[email protected]>
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.
Code Review
This pull request effectively integrates cfsctl functionality as an internal bootc command. The changes are well-structured, and the integration of the forked code is clean. I've found a critical issue that could lead to a panic and a suggestion to improve code clarity and align it with modern Rust idioms. Great work on integrating this!
This exposes the current functionality of the cfsctl binary. It's not a crate right now, and it's not a lot of code, so we just fork it. I did take the effort to use `git subtree merge` to do the import. For the record, here's how I did it: - In composefs-rs: git subtree split --prefix=crates/cfsctl - In bootc: git subtree add --prefix=crates/lib/cfsctl ../../containers/composefs-rs/ <git sha1 from above> In cfsctl I also: - Adjusted it to accept the bootc-configured composefs repo (which note is right now hardcoded to sha512, not sha256) - Dropped the http stuff since I don't think it really makes sense vs OCI Signed-off-by: Colin Walters <[email protected]>
09b046f to
9d3ccd0
Compare
jeckersb
left a comment
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.
Went over this with @cgwalters on a call 👍
This exposes the current functionality of the cfsctl binary.
It's not a crate right now, and it's not a lot of code, so we just
fork it.
I did take the effort to use
git subtree mergeto do the import.For the record, here's how I did it:
In cfsctl I also:
(which note is right now hardcoded to sha512, not sha256)
sense vs OCI
Signed-off-by: Colin Walters [email protected]