Commit Graph

305 Commits

Author SHA1 Message Date
Akihiro Suda
9d247a7993 Merge pull request #12433 from halaney/ahalaney/erofs-idmap-latest
Add erofs idmap support
2026-01-09 06:35:49 +00:00
Maksym Pavlenko
253fbe756a Cleanup unit tests
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-01-06 10:52:49 -08:00
Derek McGowan
415b5a534a Merge pull request #12567 from ChengyuZhu6/erofs-mediatype
images: add EROFS layer media type
2026-01-06 06:28:28 +00:00
Maksym Pavlenko
2bddff3f21 Merge pull request #12566 from rawahars/main
Set annotations parameter in CreateSandbox request
2026-01-05 18:45:37 +00:00
Andrew Halaney
9b50650d5c snapshots/erofs: Support idmap mounts
This disables the slow_chown feature (nobody in their right mind
is going to be choosing erofs and want to slowly chown each file),
indicates that we support idmaps if the kernel supports it, and makes
sure to chown the upperdir.

This is more or less exactly how the overlay snapshotter does things,
minus the slow_chown part (which has discussions about dropping
altogether at some point anyways).

Signed-off-by: Andrew Halaney <ahalaney@netflix.com>
2026-01-02 10:05:29 -06:00
Harsh Rawat
53e696d625 set annotations parameter in CreateSandbox request
In the CreateSandbox request, which is part of the Sandbox Controller, we ignored the `Annotations` parameter which could have been set by the caller via `WithAnnotations` option.

This commit rectifies the same and adds the Annotations parameter to the request.

Signed-off-by: Harsh Rawat <harshrawat@microsoft.com>
2025-12-29 17:01:14 +05:30
Gao Xiang
9a7500a974 Add support for EROFS fsmerge feature
EROFS has supported a tiny metadata-only image to reference external
blobs since Linux 5.16. This eliminates the need to mount each EROFS
layer one by one and is also useful for VM-based containers (e.g.
nerdbox and Kata containers.)

Similar to LCOW/CimFS, `snapshots.UnpackKeyPrefix` is used to
trigger fsmerge generation (typically < 100 ms) on demand in Prepare().

In the future, we can also generate fsmeta in Commit() of the final
unpacking layer (by introducing an annotation to keep the chainID).
However, in the case of intermediate layer reuse, the Prepare() handling
will still be required.

```toml
[plugins."io.containerd.snapshotter.v1.erofs"]
  max_unmerged_layers = 1      # enable fsmerge if image layers >= 2
```

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-12-29 17:39:09 +08:00
ChengyuZhu6
36f8999b94 images: add EROFS layer media type
Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
2025-12-23 23:19:50 +08:00
Derek McGowan
487d77ff50 Fix transfer unpack defaults on darwin
Fix the default unpack configuration on darwin to a usable
configuration.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-18 08:51:51 -08:00
Derek McGowan
497f896d65 Update default differs on darwin
Use the erofs differ by default on darwin. This could be default for all
Unix platforms but limit the default changes to fix broken cases for backports.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-18 08:51:51 -08:00
Derek McGowan
49888e001f Use default writable size in erofs snapshotter for non-Linux hosts
Non-Linux hosts are not expected to be able to directly mount erofs
snapshotters on the host system. Non-Linux hosts should use block mode
by default with a reasonably set default block size.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-18 08:51:50 -08:00
Derek McGowan
01b4c8102b Update default erofs block size on macOS during erofs diff
Use the Linux default rather than the block size from the local macOS
system. The local macOS block size is not relevant as the erofs file
will not be mounted directly on macOS.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-11-17 16:34:28 -08:00
Akihiro Suda
910171e90e Fix directory permissions
- Create /var/lib/containerd with 0o700 (was: 0o711).
- Create config.TempDir with 0o700 (was: 0o711).
- Create /run/containerd/io.containerd.grpc.v1.cri with 0o700 (was: 0o755).
- Create /run/containerd/io.containerd.sandbox.controller.v1.shim with 0o700 (was: 0o711).
- Leave /run/containerd and /run/containerd/io.containerd.runtime.v2.task created with 0o711,
  as required by userns-remapped containers.
  /run/containerd/io.containerd.runtime.v2.task/<NS>/<ID> is created with:
  - 0o700 for non-userns-remapped containers
  - 0o710 for userns-remapped containers with the remapped root group as the owner group.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-11-04 16:04:30 +09:00
Gao Xiang
7bf5b92e6e Add Readonly setup to EROFS mount loop handler
See __fsverity_file_open():

``` c
int __fsverity_file_open(struct inode *inode, struct file *filp)
{
	if (filp->f_mode & FMODE_WRITE)
		return -EPERM;
	return ensure_verity_info(inode);
}
```

Fixes: 5b9d871fea ("Add EROFS mount handler plugin")
Closes: https://github.com/containerd/containerd/issues/12451
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-11-02 08:35:52 +08:00
Wei Fu
ba524db349 snapshot: check parent's kind before commit
We should reject commit request if target parent is not committed.
Just in case we rebase active snapshot on active one.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2025-10-31 11:09:11 -04:00
Maksym Pavlenko
c07f9220cb Merge pull request #12409 from henry118/followup-12332
Remove rebase validation logic from overlay snapshotter
2025-10-27 18:42:10 +00:00
Henry Wang
d939b6af5f Remove rebase validation logic from overlay snapshotter
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-10-24 21:56:59 +00:00
Derek McGowan
7b7c5c1711 Add rebase capability to erofs
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-24 14:06:56 -07:00
Henry Wang
0198b87fcf Implement parallel unpack
Signed-off-by: Henry Wang <henwang@amazon.com>
2025-10-24 17:54:26 +00:00
Derek McGowan
9a43ee660a Merge pull request #6488 from evankanderson/main
Default config_path if legacy registry options are not set.
2025-10-24 01:28:00 +00:00
Gao Xiang
5b9d871fea Add EROFS mount handler plugin
Commit ee8ae9d569 ("Update erofs snapshotter to use mount manager")
temporarily removed the file-backed mount feature to adapt to the new
mount manager infrastructure as a quick start.

After the mount manager was introduced, a specific mount type can be
handled with a mount handler plugin to provide a dedicated mount
process (e.g. setup loopback devices in advance or calling external
mount helpers).

This commit adds a default EROFS mount handler for the Linux hosts
to set up loop devices for mount sources and "device=" external file
blobs if necessary (i.e. when file-backed mounts are unavailable),
allowing common runtimes such as runC to work directly, e.g.
 ``` sh
 mount -t erofs /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs \
  /run/containerd/io.containerd.mount-manager.v1.bolt/t/346/1
 ```
 will be handled as
 ``` sh
 mount -t erofs /dev/loop1 /run/containerd/io.containerd.mount-manager.v1.bolt/t/346/1
 ```
and
 ``` sh
 mount -t erofs /var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/7/fsmeta.erofs \
   -odevice=/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/1/layer.erofs,\
     device=/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/2/layer.erofs,\
     ...
     device=/var/lib/containerd/io.containerd.snapshotter.v1.erofs/snapshots/7/layer.erofs
   /run/containerd/io.containerd.mount-manager.v1.bolt/t/335/1
 ```
 will be handled as
 ``` sh
 mount -t erofs /dev/loop1 -odevice=/dev/loop2,device=/dev/loop3,... \
   /run/containerd/io.containerd.mount-manager.v1.bolt/t/335/1
 ```
if file-backed mounts are unavailable.

For other host platforms (e.g. Darwin hosts) or specific runtimes
that require EROFS raw mounts instead of parsed mounts, this plugin
can be explicitly masked off by users.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-10-22 22:57:42 +08:00
Gao Xiang
8a6e6263f8 Support arbitary mkfs size (not only in MiB)
Rename `default_size_mb` to `default_size` so that it's similar to
Docker's `--storage-opt size=30G` flag.  For example,

``` toml
[plugins."io.containerd.snapshotter.v1.erofs"]
  default_size = "5GB"
```

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-10-21 15:35:05 +08:00
Fu Wei
e95415b723 Merge pull request #12333 from dmcgowan/erofs-block-files
Update erofs snapshotter to use mount manager
2025-10-20 02:43:50 +00:00
Evan Anderson
5386802f8a Default config_path if legacy registry options are not set.
Signed-off-by: Evan Anderson <evan.k.anderson@gmail.com>
2025-10-16 17:51:44 -07:00
Derek McGowan
2f75989e2a Update erofs to use mount transformers
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-14 22:53:43 -07:00
Derek McGowan
be9f183f45 Add mount transformers to mount manager
Extend the mount manager to support more transformers than format. The
transformers allow altering the mount before it is passed to the mount
handlers. These could be one-time actions which are needed to perform
the mount.

Adds mkdir and mkfs actions which can be used to prepare the arguments
for a mount. The actions can be limited to actions within the target
mount directory or plugin directories.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-14 16:35:53 -07:00
Derek McGowan
1adaf27c1e Update erofs to compile on Darwin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-13 19:33:44 -07:00
Derek McGowan
ee8ae9d569 Update erofs snapshotter to use mount manager
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-13 19:33:44 -07:00
ningmingxiao
ed2e81a78e bugfix:sync parent dir to ensure blob entry is reliably stored
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-10-11 20:22:14 +08:00
Aadhar Agarwal
773bfa0eae Use tartest to simplify generating a tar
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2025-10-08 21:35:19 +00:00
Aadhar Agarwal
6a3b10fe76 Add a test for the erofs differ using tar index mode
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2025-10-08 21:35:16 +00:00
Derek McGowan
e2157e37df Merge pull request #12345 from dmcgowan/fix-sandbox-controller-dependencies
Fix sandbox controller dependencies
2025-10-03 20:46:33 +00:00
Derek McGowan
843aee8d3f Merge pull request #12342 from dmcgowan/fix-sandbox-client
Fixes for sandbox client
2025-10-03 20:39:45 +00:00
Fu Wei
61ddcd5372 Merge pull request #12063 from dmcgowan/mount-manager
Add mount manager
2025-10-03 14:01:38 +00:00
Derek McGowan
c69f443ba8 Update sandbox controllers service implicit dependency
The sandbox controller should only error out if it cannot find any
sandbox controllers. If it requires the pod sandbox controller to be
initialized, that creates an implicit dependency on all CRI plugins
being initialized. The sandbox controller API can be used without CRI
and therefore should not have this dependency.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-02 16:49:39 -07:00
Derek McGowan
637429a252 Update logging for sandbox controller service
Add more details and differentiate log line from sandbox store calls

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-01 17:14:16 -07:00
Derek McGowan
aba772012a Add debug logs to mount service calls
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:32 -07:00
Derek McGowan
d23e635a5c Fix mount manager plugin when no handlers provided
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:32 -07:00
Derek McGowan
8db3010865 Add mounts api service
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-29 17:08:31 -07:00
Rehan Khan
33e6b79fc0 Fix device mapper suspend/resume flakyness
Signed-off-by: Rehan Khan <Rehan.Khan7@ibm.com>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-09-24 01:37:36 +08:00
Derek McGowan
ed03f3a710 Add mount manager plugin and types
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-18 17:08:43 -07:00
Derek McGowan
37cec68004 Move transaction context to boltutil
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-09-18 17:08:42 -07:00
Enji Cooper
f45716efed Clean up issues cited by usetesting package with golangci
This commit makes all of the recommended changes to use the `testing`
package helper functions instead of doing the equivalent longhand
versions of the same thing.

This change was needed in order to properly detect errors, as the code
would previously skip running `tenv` stating that it had been deprecated
in favor of `usetesting`.

Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
2025-09-07 14:07:40 -07:00
Maksym Pavlenko
f4dfa9968b Merge pull request #12168 from ningmingxiao/fix_lastCollection
gc:make sure lastCollection is not nil
2025-09-02 00:15:10 +00:00
ningmingxiao
683cd7d60d gc:make sure lastCollection is not nil
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-09-01 10:48:38 +08:00
Amit Barve
009625290b Block CIM snapshotter & differ
Add new snapshotter & differ plugins that can leverage the block CIM layer writers to
store pulled/imported images in the block CIM format.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
2025-07-30 14:46:59 -04:00
Akihiro Suda
a92d8700bf Merge pull request #12085 from akhilerm/pause-3.10.1
update pause image to pause:3.10.1
2025-07-15 06:12:20 +00:00
Akhil Mohan
222b2d3e72 update pause image to pause:3.10.1
Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
2025-07-11 11:29:02 +05:30
Gao Xiang
e96ebc0085 erofs-snapshotter: make IMMUTABLE_FL optional
Enabling the IMMUTABLE_FL file attribute causes dirty data to be
flushed synchronously at least on EXT4, which can greatly impact
container launch performance.  In contrast, the overlayfs snapshotter
does not use syncfs by default.

Most users may not need IMMUTABLE_FL, let's make IMMUTABLE_FL optional
to align with the behavior of the overlayfs snapshotter and recover the
original performance.

1. tensorflow

Test commands:
$ nerdctl image pull --snapshotter=X --unpack="false" tensorflow/tensorflow:2.19.0
$ time nerdctl container --snapshotter=X run -d tensorflow/tensorflow:2.19.0 /bin/sh

Results:
 overlayfs                 | 0m18.748s
 erofs (no IMMUTABLE_FL)   | 0m10.090s
 erofs (with IMMUTABLE_FL) | 0m21.074s

2. ubuntu 22.04

Test commands:
$ nerdctl image pull --snapshotter=X --unpack="false" ubuntu:22.04
$ time nerdctl container --snapshotter=X run -d ubuntu:22.04 /bin/sh

Results:
 overlayfs                 | 0m1.147s
 erofs (no IMMUTABLE_FL)   | 0m0.795s
 erofs (with IMMUTABLE_FL) | 0m1.094s

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2025-07-11 02:56:37 +08:00
Aadhar Agarwal
b641933cfa erofs snapshotter: Add tar index mode
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>

Minor style updates to erofs.md and differ_linux.go

Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>

Add use case for tar index in erofs.md

Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2025-07-08 21:44:49 +00:00