mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-04-26 10:32:28 +00:00
kata-deploy: Complete containerd config for erofs snapshotter
Add missing containerd configuration items for erofs snapshotter to enable fsmerged erofs feature: Add snapshotter plugin configuration: - default_size: "10G" # can be customized - max_unmerged_layers: 1 # Fixed with 1 These configurations align with the documentation in docs/how-to/how-to-use-fsmerged-erofs-with-kata.md Step 2, ensuring the CI workflow run-k8s-tests-coco-nontee-with-erofs-snapshotter can properly configure containerd for erofs fsmerged rootfs. Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
This commit is contained in:
committed by
Fabiano Fidêncio
parent
04e0f1c403
commit
7f7cca16fa
@@ -12,10 +12,7 @@ use log::info;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
pub async fn configure_erofs_snapshotter(
|
||||
_config: &Config,
|
||||
configuration_file: &Path,
|
||||
) -> Result<()> {
|
||||
pub async fn configure_erofs_snapshotter(config: &Config, configuration_file: &Path) -> Result<()> {
|
||||
info!("Configuring erofs-snapshotter");
|
||||
|
||||
toml_utils::set_toml_value(
|
||||
@@ -40,6 +37,43 @@ pub async fn configure_erofs_snapshotter(
|
||||
".plugins.\"io.containerd.snapshotter.v1.erofs\".set_immutable",
|
||||
"true",
|
||||
)?;
|
||||
// Turn off fsmerge unless we are configuring for a Rust shim below. Writing 0
|
||||
// first keeps behavior explicit and resets a stale max_unmerged_layers in this
|
||||
// drop-in after switching away from Rust / fsmerged EROFS on the same node.
|
||||
toml_utils::set_toml_value(
|
||||
configuration_file,
|
||||
".plugins.\"io.containerd.snapshotter.v1.erofs\".max_unmerged_layers",
|
||||
"0",
|
||||
)?;
|
||||
|
||||
// The remaining settings only apply to runtime-rs (rust shim) which
|
||||
// supports fsmerged EROFS. The go runtime does not, so we leave the
|
||||
// differ and snapshotter plugins at their defaults for it.
|
||||
let is_rust_shim = config.shims_for_arch.iter().any(|s| utils::is_rust_shim(s));
|
||||
if is_rust_shim {
|
||||
// Erofs differ plugin options (requires erofs-utils >= 1.8.2 on the host).
|
||||
toml_utils::set_toml_value(
|
||||
configuration_file,
|
||||
".plugins.\"io.containerd.differ.v1.erofs\".mkfs_options",
|
||||
"[\"-T0\",\"--mkfs-time\",\"--sort=none\"]",
|
||||
)?;
|
||||
toml_utils::set_toml_value(
|
||||
configuration_file,
|
||||
".plugins.\"io.containerd.differ.v1.erofs\".enable_tar_index",
|
||||
"false",
|
||||
)?;
|
||||
|
||||
toml_utils::set_toml_value(
|
||||
configuration_file,
|
||||
".plugins.\"io.containerd.snapshotter.v1.erofs\".default_size",
|
||||
"\"10G\"",
|
||||
)?;
|
||||
toml_utils::set_toml_value(
|
||||
configuration_file,
|
||||
".plugins.\"io.containerd.snapshotter.v1.erofs\".max_unmerged_layers",
|
||||
"1",
|
||||
)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user