Commit Graph

370 Commits

Author SHA1 Message Date
Derek McGowan
0c511e068b snapshots/erofs: keep lowers stacked above a merged fsmeta
mounts() moved `first` to the merged fsmeta mount's index whenever
mountFsMeta matched, collapsing the overlay's lowerdir range to the
fsmeta alone and dropping any plain lowers already appended above it.

When fsmerge was added, fsmeta was only ever written for the top
parent of the chain being prepared, so the loop matched at i == 0,
where first already equalled the fsmeta's index and the reassignment
was a no-op. It only mattered once the fsmeta could sit below the top
parent, i.e. a chain extending an already-merged sub-chain. The
snapshotter no longer generates fsmeta itself, so today this only
affects externally supplied fsmeta files.

first only marks the start of the lowerdir range, so it must stay at
the first lower's index.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-07-31 06:01:26 +08:00
Samuel Karp
dc98141df7 cri: deprecate restore in CreateContainer
Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-07-28 18:10:35 +00:00
Samuel Karp
dacd4c7d00 cri: validate CRIU availability and version early
Perform an early validation check on both container checkpoint and
restore paths to fail-fast if the CRIU binary is missing or is older
than the minimum required version (3.16.0).

To support runtime-configured environments, the validation respects the
custom PATH from the shim manager environment if configured, skipping
any relative paths to avoid incorrect daemon-relative resolution. If not
configured, it falls back to a standard system PATH lookup. The check
result is cached using sync.Once to prevent redundant process spawning.

Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-07-08 07:03:43 +00:00
Maksym Pavlenko
5282d4e09d Wire task address and version fields
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-05-19 03:18:33 +00:00
Maksym Pavlenko
2315484b7e Merge pull request #13390 from k8s-infra-cherrypick-robot/cherry-pick-13363-to-release/2.3
[release/2.3] server: tolerate failed gRPC plugins when starting listeners
2026-05-12 21:05:55 -07:00
Akihiro Suda
2be0710b81 overlay: disable "rebase" capability when running in UserNS
Fix issue 13388

```
[...]
May 12 16:57:23 kind-control-plane kubelet[257]:         failed to extract layer (application/vnd.docker.image.rootfs
.diff.tar sha256:6f1cdceb6a3146f0ccb986521156bef8a422cdbb0863396f7f751f575ba308f4) to overlayfs as "extract-920875437
-7QPF sha256:31e64620332e54e3e4fb246d8325ed2c9f1c2cc64a95f0bb23b4b7e82834c95a": failed to mount /var/lib/containerd/t
mpmounts/containerd-mount2180142388: mount source: "overlay", target: "/var/lib/containerd/tmpmounts/containerd-mount
2180142388", fstype: overlay, flags: 0, data: "upperdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/sn
apshots/279/fs", err: invalid argument
[...]
```

This was a regression introduced in PR 13115.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-05-12 20:13:03 +00:00
Akihiro Suda
3a88fdde0c server: tolerate failed gRPC plugins when starting listeners
The grpc, grpc-tcp, and ttrpc server plugins enumerated their services
through ic.GetByType, which short-circuits on the first plugin whose
Instance() returned an error. A single failed gRPC plugin (e.g. CRI
under rootless, which cannot watch /etc/cni/net.d) therefore prevented
the server plugins from initialising, leaving /run/containerd/containerd.sock
uncreated.

Iterate the plugin set directly and skip plugins that failed to
initialise, restoring the pre-c15ec2485 behaviour where the listener
is still created and only the failed services are missing.

Fixes: c15ec2485 ("Add server plugins for grpc and ttrpc")
Fixes: https://github.com/containerd/containerd/issues/13362

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-05-12 17:54:02 +00:00
Brian Goff
d666d2e426 Refactor transfer unpack configuration setup
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2026-05-10 12:33:10 +00:00
Brian Goff
ccc3bd7b90 Fix optional transfer differ setup
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2026-05-10 12:33:10 +00:00
Derek McGowan
b7f8c3510d erofs: remove fsmerge threshold from snapshotter
Currently the metadata may be generated after a snapshot is committed,
causing a difference in the overlayfs mount that may cause ESTALE errors.
The committed snapshot must be immutable and should always return the
same set of mounts after commit, even if configuration is changed.

This setting may be added back later to be performed before commit,
either as part of the unpack or as a step before commit. This is getting
pulled out from the upcoming release.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-29 16:26:45 -07:00
Fu Wei
f9372eccf3 Merge pull request #13269 from Apokleos/erofs-dmverity-label
snapshotter/erofs: pass explicit dm-verity metadata path via mount options
2026-04-25 20:59:12 +00:00
Alex Lyn
31ca428580 snapshots/erofs: pass dm-verity metadata path via mount options
Update the EROFS snapshotter to pass the dm-verity metadata path
through the `X-containerd.dmverity` mount option. Previously, the
system relied on implicit mode detection; providing the explicit
path allows downstream components (such as Kata Containers mount
handlers) to reliably locate and read `.dmverity` files.

Correspondingly, update the EROFS mount handler to parse and utilize
this explicit metadata path for dm-verity device initialization.
This enables the runtime to retrieve root hashes and other necessary
metadata directly, ensuring robust layer integrity verification.

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2026-04-25 18:34:57 +08:00
Samuel Karp
1919564f6c Merge pull request #13147 from tianon/sha512
Improve support for non-canonical digests (sha512, etc)
2026-04-22 23:04:22 +00:00
William Myers
557c54b116 sandbox: forward Create fields, fix event topics
The gRPC sandbox controller service only forwarded the `options` field
when calling the local controller. The `netns_path`, `rootfs`, and
`annotations` fields were silently dropped, causing clients using the
gRPC proxy path to receive incomplete sandbox configurations.

Event topics were missing the leading `/` prefix ("sandboxes/create"
instead of "/sandboxes/create"), causing the event exchange to reject
the publish and return an error to the caller.

Add unit tests for the controller service that exercise all RPC
methods.

Signed-off-by: William Myers <willmyrs@amazon.com>
2026-04-22 18:34:56 +00:00
Fu Wei
46a7bd7acb Merge pull request #12562 from dmcgowan/plugin-api-handlers
Add plugins for server listeners
2026-04-22 17:27:28 +00:00
Albin Kerouanton
4dc3d6d6f5 Default to euid/egid in ttrpc & grpc server plugins
Signed-off-by: Albin Kerouanton <albin.kerouanton@docker.com>
2026-04-21 18:03:10 -07:00
Derek McGowan
a2b19072b8 Add metrics server plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-21 18:02:40 -07:00
Derek McGowan
c15ec24857 Add server plugins for grpc and ttrpc
Migrate configuration and move server initialization

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-21 18:02:40 -07:00
Derek McGowan
06c23567c0 Add new server plugin type use for debug server
The new server plugin type allows services which have listeners to be
configured as plugins rather than defined directly in the global
configuration. This provides more configuration consistency and allows
containerd to be extended for new types of api handlers.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-21 18:02:00 -07:00
Tianon Gravi
c5abec030a Add a warning when re-hash occurs during blob commit
(but only if the re-hash takes a "non-trivial" amount of time; currently hard-coded to 250ms)

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2026-04-21 13:17:19 -07:00
Tianon Gravi
71191c7e27 Improve support for non-canonical digests (sha512, etc)
This is all specific to the content store -- prior to this change, `ctr content fetch docker.io/tianon/test:sha512-blobs` fails with errors about `sha256` digests, and after this change it succeeds and ingests the `sha512` blobs successfully.

In the interest of full disclosure, this change was mostly authored by myself without any AI-assistance, but Claude was used to find the appropriate tests to update and to understand why the metadata service would clear out `Digest` when passing details to the content store and thus the appropriate fix being in the Writer's Commit method (re-hashing after Close when the digest algorithm was previously unknown but is known and non-canonical during Commit).  I had a very active hand in instructing Claude on exactly which changes to make and where to make them, and I spent a lot of time reviewing them to make sure I not only understand but agree with the changes that it authored.

Signed-off-by: Tianon Gravi <admwiggin@gmail.com>
2026-04-21 13:17:18 -07:00
Derek McGowan
d7ed3bf319 Merge pull request #12555 from ChengyuZhu6/ctr-erofs
ctr: add EROFS image conversion support
2026-04-15 06:54:12 +00:00
ChengyuZhu6
b320d3c855 ctr: add EROFS image conversion support
Add EROFS conversion support to ctr convert command with configurable
options for tar-index mode and mkfs parameters.

Usage:
  ctr image convert --erofs src:tag dst:tag
  ctr image convert --erofs --erofs-compression='lz4hc,12' src:tag dst:tag

Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
2026-04-15 10:28:47 +08:00
Gao Xiang
3b357da496 snapshotter/erofs: avoid using overlay if fsmerge is enabled and no upperdir
If fsmerge is enabled and no write is needed, it can return an overlay
mount with a single lowerdir, which is illegal for overlayfs.

For example, it can cause the following Nerdctl error:
 : I'm not sure why ctr works, but the issue is real.

```bash
$ nerdctl run --runtime io.containerd.kata.v2 --snapshotter=erofs -it --rm nginx:latest /bin/bash
FATA[0000] failed to mount {Type:overlay Source:overlay Target: Options:[lowerdir=/run/containerd/
io.containerd.mount-manager.v1.bolt/t/7/1]} on "/tmp/initialC2039543827": mount source: "overlay",
target: "/tmp/initialC2039543827", fstype: overlay, flags: 0, data: "lowerdir=/run/containerd/io.
containerd.mount-manager.v1.bolt/t/7/1", err: invalid argument
```

Switch to using a bind mount instead.

Fixes: 9a7500a974 ("Add support for EROFS fsmerge feature")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-04-13 17:52:29 +08:00
Fu Wei
997f813b5c Merge pull request #13185 from erofs/erofs-layers
erofs-differ: support zstd-wrapped EROFS layers
2026-04-12 22:20:11 +00:00
Gao Xiang
b9445fb9ef erofs-differ: support zstd-wrapped EROFS layers
Although EROFS has native compression support (and each filesystem can
contain multiple compression algorithms), in many cases, people only
consider using zstd compression when transporting on the wire in order
to reduce the pulling time but maintain the optimal runtime performance.

Only `+zstd` is considered: it has skippable frames which will be used
for the seekable EROFS implementation in future containerd versions.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-04-13 01:38:45 +08:00
Derek McGowan
a755ca16e5 Merge pull request #12865 from dmcgowan/readonly-overlay-erofs-no-mount
Support reading readonly overlays without mounting
2026-04-09 18:37:15 +00:00
Derek McGowan
0b164554be Merge pull request #13186 from erofs/walking_differ
diff/walking: enable mount manager
2026-04-09 15:35:08 +00:00
Gao Xiang
47cfd1138b diff/walking: enable mount manager
The default walking applier performs a real temporary mount for
unpacking, but the mount manager failed to adapt to the walking
differ.

This fixes the EROFS snapshotter together with the default walking
differ, otherwise it reports:

```
ctr: apply layer error for "[]": failed to extract layer sha256:[]:
failed to mount /var/lib/containerd/tmpmounts/containerd-mount3992073457:
internal mount option "X-containerd.mkfs.fs=ext4" was not consumed by
the mount manager
```

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-04-09 14:17:35 +08:00
Derek McGowan
30951c6f03 Add overlay symlink resolution using ReadLinkFS
Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-04 22:37:39 -07:00
Derek McGowan
21d666cfbc Update fsview to allow type registration
Move erofs implementation to plugin and register with fsview.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-04 22:37:38 -07:00
Maksym Pavlenko
78bcb44a34 Merge pull request #13132 from pierluigilenoci/fix/honor-stderrthreshold
Honor stderrthreshold when logtostderr is enabled
2026-04-04 16:10:11 +00:00
Sergey Kanzhelev
05d3b31586 pause image 3.10.1 -> 3.10.2 for add Windows Server 2025 (ltsc2025) support
Signed-off-by: Sergey Kanzhelev <S.Kanzhelev@live.com>
2026-04-03 16:17:39 +00:00
Pierluigi Lenoci
2a69c0d2c8 Honor stderrthreshold when logtostderr is enabled
klog has a long-standing bug where setting -logtostderr=true causes the
-stderrthreshold flag to be silently ignored. All log messages are sent
to stderr regardless of their severity.

klog v2.140.0 introduced two new flags that allow callers to opt into the
correct behavior:

  -legacy_stderr_threshold_behavior=false
  -stderrthreshold=INFO

Set them in the CRI plugin's setGLogLevel() function, right after
klog.InitFlags() and before any other flag configuration.

Reference: kubernetes/klog#212
Signed-off-by: Pierluigi Lenoci <pierluigi.lenoci@gmail.com>
2026-04-03 10:53:54 -05:00
Gao Xiang
cb93966b9f transfer: Default to the EROFS snapshotter and differ for EROFS images
If no snapshotter is specified and `os.features` contains "erofs",
unpacking should use the EROFS snapshotter and differ.

This enhances the usability of native EROFS container images.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-04-01 13:18:23 +08:00
Aadhar Agarwal
50f5461fb7 Add dmverity support to the erofs snapshotter using veritysetup-go
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com>
2026-03-31 20:21:39 +00:00
Maksym Pavlenko
1568602fec Merge pull request #13080 from erofs/transfer-differ-fix
transfer: fix the differ selection if differ is ""
2026-03-23 21:47:24 +00:00
Sergey Kanzhelev
27f0b12937 fix linter issues
Signed-off-by: Sergey Kanzhelev <S.Kanzhelev@live.com>
2026-03-22 22:52:10 +00:00
Gao Xiang
dc9cb1dfd5 transfer: fix the differ selection if differ is ""
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
2026-03-21 15:31:09 +08:00
Sebastiaan van Stijn
22fd63994e *: modernize: stringscutprefix
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:17 +01:00
Sebastiaan van Stijn
860d97854f plugins: modernize: plusbuild
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:17 +01:00
Sebastiaan van Stijn
8fcf3a3cf1 *: modernize: rangeint
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:16 +01:00
Sebastiaan van Stijn
5ccb356620 plugins: modernize: any
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:11 +01:00
Derek McGowan
489b653034 Merge pull request #13022 from thaJeztah/modernize
*: modernize code
2026-03-16 22:23:04 +00:00
Samuel Karp
3e9f21c439 nri: add dependency on internal tracing plugin
Ensure that the internal tracing plugin is initialized before the
NRI plugin. This ensures that NRI has access to the global
TracerProvider when it initializes its TTRPC interceptors.

Assisted-by: gemini-cli
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-03-16 09:57:34 -07:00
Sebastiaan van Stijn
2fd5da21ed *: modernize: waitgroup
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -waitgroup -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 18:24:15 +01:00
Sebastiaan van Stijn
4b6cc97c4d plugins: modernize: any
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -any -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 18:24:15 +01:00
Sebastiaan van Stijn
cd3d63d913 *: modernize: fmtappendf
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -fmtappendf -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 18:24:14 +01:00
Sebastiaan van Stijn
b050f47efc *: modernize: testingcontext
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -testingcontext -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 18:24:03 +01:00
Sebastiaan van Stijn
b35d9ea929 plugins: modernize: rangeint
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -rangeint -fix ./...

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 14:56:20 +01:00