Commit Graph

1062 Commits

Author SHA1 Message Date
Fu Wei
2600710ddb Merge pull request #13735 from AkihiroSuda/whiteout-test
integration: build the whiteout-test image locally
2026-07-31 15:15:31 +00:00
Maksym Pavlenko
dd654ecca0 Fix does not contain \x00 on windows
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-07-21 21:39:27 -07:00
Akihiro Suda
f418688f2c integration: build the whiteout-test image locally
Build the image for TestIssue13030 locally using pkg/archive,
instead of pulling the prebuilt ghcr.io/containerd/whiteout-test image.

The image is built by appending layers generated with archive.WriteDiff
on top of the busybox base image, served with the new
testutil.ServeImage helper on a localhost HTTP registry, and pulled
through the regular client.Pull path with WithPullUnpack. This removes
the need to publish the multi-arch whiteout-test image, so the
Dockerfile and Makefile added in PR 13704 are removed along with the
image list entry.

Assisted-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2026-07-08 23:39:42 +09:00
Henry Wang
cb3c0f0665 Add dockerfile for the whiteout-test test image
Signed-off-by: Henry Wang <henry118@gmail.com>
2026-07-02 17:20:54 +00:00
Wei Fu
3d80ce2881 integration: add http trace for debug
This is used to debug the flaky test case - TestCRIImagePullTimeout

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-06-18 12:46:59 -04:00
Samuel Karp
45cc0c578e integration: use streaming Read in test mirror limiter
The TestCRIImagePullTimeout test case "NoDataTransferred" flaked under
constrained networks because the test proxy mirror registry used a
blocking ReadAtLeast call to forward bytes to containerd.

This blocking wait (up to 4KB) meant the mirror registry server
completely stopped forwarding data during network slowness, triggering
containerd's aggressive 5-second progress timeout and canceling the
pull before it could reach its 3MB circuit-breaker limit.

This is resolved by changing the proxy's custom copy loop from
io.ReadAtLeast(src, buf, len(buf)) to standard src.Read(buf). This
streams network chunks to containerd immediately as they arrive,
preventing false timeout cancellations while maintaining correct
circuit-breaker byte tracking.

Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-06-02 14:53:39 -07:00
Samuel Karp
a9fba66231 integration: deflake TestFailFastWhenConnectShim
In high-load CI environments,
TestFailFastWhenConnectShim/normal-unix-socket-v2 flaked with:
  expected error connection refused, but got <nil>
at shim_dial_unix_test.go:134.

Diagnosis:
For normal Unix sockets (filesystem-backed, where
SetUnlinkOnClose(false) is called to keep the socket file), closing
the socket listener does not guarantee that subsequent dials
instantly fail with ECONNREFUSED in the OS kernel. Under high
parallel contention, the kernel-side transition of the socket file
structure to the refusing state is deferred for a brief window.
The test immediately dials the address after close, which
unexpectedly succeeds under load, flaking the test.

Reproduction:
We successfully reproduced the flake inside an almalinux/9 Vagrant VM
(running with nested virtualization inside a GCE VM) under parallel
load, where the test failed exactly on iteration 3 of the integration
suite loop.

Solution:
1. Remove manual listener.Close() and rely entirely on
ttrpcSrv.Shutdown(ctx) to close the listener, preventing double-close
races.
2. Use a 5-second timeout context for Shutdown to prevent CI hangs if a
connection leaks.
3. Implement a robust 2-second polling helper pollECONNREFUSED inside
the test that dials in a 10ms loop (using a 100ms dial timeout to avoid
blocking) until it receives syscall.ECONNREFUSED.
4. Assert require.NoError(t, pollECONNREFUSED(addr)) immediately after
Shutdown to ensure the OS has fully unlinked/closed the socket before
running the main assertions.

Tested:
Verified by executing 15 parallel integration test runs inside the
preserved AlmaLinux 9 Vagrant guest VM. All 15 runs passed
successfully (100% success rate).

Assisted-by: Antigravity
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-05-22 13:15:16 -07:00
Samuel Karp
bc69a52680 Merge pull request #13167 from lauralorenz/10681-ctr-image-export-oci-ref-name
#10681 by-digest `ctr image export` of `org.opencontainers.image.ref.name`
2026-04-28 22:29:59 +00:00
sreeram-venkitesh
1b1aba4b66 Added stop signal to container termination logic and container status
Signed-off-by: sreeram-venkitesh <sreeramvenkitesh@gmail.com>
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-04-27 07:52:09 -05:00
Fu Wei
1aef5484c5 Merge pull request #12667 from dmcgowan/transfer-extrarefs-gc
Update transfer service to support automatically garbage collecting extra references
2026-04-24 16:11:21 +00:00
Derek McGowan
978c03f83a Update import tests to handle index and manifest digests
Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-23 11:20:16 -07:00
Davanum Srinivas
c30f23452c cri: use upstream Kubernetes modules
Switch the CRI integration layer from containerd's forked Kubernetes helpers
and clients to the upstream Kubernetes modules, and finalize the dependency
update to Kubernetes v0.36.0.

Replace the remaining internal helper copies with upstream packages:
- internal/cri/clock -> k8s.io/utils/clock
- internal/cri/executil -> upstream CRI exec helpers
- internal/cri/resourcequantity -> k8s.io/apimachinery/pkg/api/resource
- internal/cri/setutils -> k8s.io/apimachinery/pkg/util/sets
- internal/cri/types/labels.go -> internal/cri/labels
- integration/cri-api/pkg/apis/services.go -> k8s.io/cri-api/pkg/apis/services.go

Adopt the upstream CRI clients directly:
- add k8s.io/cri-client v0.36.0, k8s.io/cri-streaming v0.36.0, and
  k8s.io/streaming v0.36.0 as direct dependencies
- promote k8s.io/utils to a direct dependency and pull in
  k8s.io/component-base v0.36.0 indirectly
- keep integration/remote as a thin containerd adapter around cri-client,
  because the integration tests still need the stream-shaped
  GetContainerEvents RPC

Finalize the Kubernetes dependency update from v0.36.0-rc.0 to v0.36.0,
refresh vendor/, and drop the obsolete internal utility copies.

Also fix the protobuf MessageState mutex-copy vet failures exposed by the new
APIs and close the temporary integration CRI clients explicitly.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2026-04-23 12:59:58 +02: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
Derek McGowan
5d8c1433a7 Update restart monitor test to not use deprecated address field
Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-21 18:02:41 -07:00
Chris Henzie
93f7a62e50 Support both styles of volatile mount option
Kernel 6.12.80+ returns 'fsync=volatile' instead of just 'volatile'
in mount options, which breaks containerd's exact string matching
checks.

Fixes this issue by adding support for 'fsync=volatile' in addition
to the existing 'volatile' check in RemoveVolatileOption and
addVolatileOptionOnImageVolumeMount.

Assisted-by: Antigravity
Signed-off-by: Chris Henzie <chrishenzie@gmail.com>
2026-04-20 11:50:57 -07:00
Laura Lorenz
75d32fda0f Check for digest only when setting org.opencontainers.image.ref.name
On export, if the image is by-digest without any tag,
set the org.opencontainers.image.ref.name as the full name.
This prevents setting this field with a leading non-alphanum,
which is incorrect OCI grammar. Fixes #10681.

Signed-off-by: Laura Lorenz <lauralorenz@google.com>
2026-04-15 22:15:58 +00:00
Laura Lorenz
e62fd80ade Add test for org.opencontainers.image.ref.name grammar
Uses the definition of valid grammar for this field
from the OCI image annotations spec:
e72ae99d5f/annotations.md (pre-defined-annotation-keys)

On this commit the test will fail per the bug #10681
`manifest annotation org.opencontainers.image.ref.name
="@sha256:7b3ccabffc97de872a30dfd234fd972a66d247c8cfc69b0550f276481852627c"
 does not match required grammar`

Signed-off-by: Laura Lorenz <lauralorenz@google.com>
2026-04-10 15:59:55 +00:00
Maksym Pavlenko
73edc80451 Format code after cherry pick
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-04-08 08:29:28 -05:00
Derek McGowan
243cab594e Deprecate old pkg/shim interfaces
Signed-off-by: Derek McGowan <derek@mcg.dev>
2026-04-08 08:29:28 -05:00
Jintao Zhang
72919fbd66 integration/images: add s390x builds for volume test images
Ensure volume-copy-up and volume-ownership publish linux/s390x variants so integration tests can use these images on s390x without architecture-specific skips.

Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
2026-04-06 01:31:34 +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
Ricardo Branco
2b7085767c Skip TestExportAndImportMultiLayer on s390x
The test image ghcr.io/containerd/volume-copy-up:2.1 does not include
a manifest for s390x, causing the test to fail with:
"no manifest found for platform: not found".

Signed-off-by: Ricardo Branco <rbranco@suse.de>
2026-04-02 18:46:20 +02:00
Samuel Karp
40249d13a3 Merge pull request #13090 from SergeyKanzhelev/go126
Bump Go to 1.26.0
2026-03-31 23:53:05 +00:00
Maksym Pavlenko
ac77420204 Merge pull request #13144 from chrishenzie/update-crun-1.27
Update crun version to 1.27 and enable in mount options test
2026-03-31 23:48:48 +00:00
Sergey Kanzhelev
0130ae9aa8 Bump Go to 1.26.0
This change updates the Go version from 1.25.8 to 1.26.0 across the
repository, including CI configurations, build scripts, and development
environments.

It also fixes two linter issues discovered after upgrading the Go version:
- core/snapshots/storage/bolt.go: incorrect printf format for uint64
- plugins/transfer/plugin.go: incorrect printf format for int and unused variable

The golangci-lint version in script/setup/install-dev-tools is also updated to v2.9.0
to match CI.

Signed-off-by: Sergey Kanzhelev <S.Kanzhelev@live.com>
2026-03-31 22:58:42 +00:00
Chris Henzie
9f62f84c5d Update crun version to 1.27 and enable in mount options test
Updates crun version used by integration tests to 1.27 and enables the
test for cgroup mount options in
TestPrivilegedContainerCgroupMountOptions.

Assisted-by: Antigravity
Signed-off-by: Chris Henzie <chrishenzie@gmail.com>
2026-03-31 10:38:01 -07:00
Samuel Karp
b7a467e4f3 Merge pull request #12175 from smira/fix/hide-go-cmp
fix: hide `go-cmp` library from the non-test code path
2026-03-30 20:21:10 +00:00
HirazawaUi
339b0cc171 add integration test
Signed-off-by: HirazawaUi <695097494plus@gmail.com>
2026-03-30 09:01:49 -05:00
Maksym Pavlenko
546ce38287 Merge pull request #13115 from henry118/bug-13030-2
Tweak mount info for overlayfs in case of parallel unpack
2026-03-25 20:12:51 +00:00
Samuel Karp
248b1a665b Merge pull request #12952 from chrishenzie/mount-option-removal
Preserve cgroup mount options for privileged containers
2026-03-24 22:04:09 +00:00
Henry Wang
68e128cf03 Add integration test for issue 13030
Signed-off-by: Henry Wang <henwang@amazon.com>
2026-03-24 18:03:26 +00:00
Chris Henzie
0eef29a1a9 Add integration test for privileged container cgroup mounts
Verifies that running a privileged container does not alter host cgroup
mount options (specifically nsdelegate and memory_recursiveprot).

Creates a privileged sandbox and container, starts it, and compares the
host's /sys/fs/cgroup mount options before and after execution to
guarantee safety.

Signed-off-by: Chris Henzie <chrishenzie@gmail.com>
2026-03-23 12:22:37 -07:00
Sebastiaan van Stijn
a5cfa74d5e integration: modernize: omitzero
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:17 +01: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
9bdcacc45f *: modernize: waitgroup
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:17 +01:00
Sebastiaan van Stijn
24012ef8f6 *: modernize: stringscut, stringsseq, slicescontains, fmtappendf
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:17 +01:00
Sebastiaan van Stijn
4dd7c13ac4 *: modernize: stringscut, stringsseq
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:17 +01:00
Sebastiaan van Stijn
1ed2b15c08 *: modernize: minmax
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:16 +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
9ee303d70e *: modernize: any
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-17 13:36:16 +01:00
Andrey Smirnov
ea945443ac fix: hide go-cmp library from the non-test code path
The `go-cmp` library has issues with Go deadcode elimination:

```
github.com/google/go-cmp/cmp/internal/value.appendTypeName reachable from:
         github.com/google/go-cmp/cmp.pathStep.String
         type:github.com/google/go-cmp/cmp.pathStep
         type:github.com/google/go-cmp/cmp.structField
         type:*github.com/google/go-cmp/cmp.structField
         type:github.com/google/go-cmp/cmp.StructField
         go:itab.github.com/google/go-cmp/cmp.StructField,github.com/google/go-cmp/cmp.PathStep
         github.com/google/go-cmp/cmp.Path.String
         type:github.com/google/go-cmp/cmp.Path
         type:github.com/google/go-cmp/cmp.state
         type:*github.com/google/go-cmp/cmp.state
         type:func(*github.com/google/go-cmp/cmp.state, reflect.Type, reflect.Value, reflect.Value) github.com/google/go-cmp/cmp.applicableOption
         type:github.com/google/go-cmp/cmp.Option
         github.com/google/go-cmp/cmp.flattenOptions
         github.com/google/go-cmp/cmp.normalizeOption
         github.com/google/go-cmp/cmp.FilterValues
         github.com/containerd/containerd/v2/pkg/protobuf.init
         github.com/containerd/containerd/v2/pkg/protobuf..inittask
         go:main.inittasks
```

The `pkg/protobuf` is imported unconditionally is
`github.com/containerd/containerd` Go module is imported via init tasks,
so there is no way e.g. to use containerd client without triggering this
import.

It seems that within containerd itself this function is only used from
tests, so hiding it this way allows to import `containerd/client` while
keeping deadcode elimination.

Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
2026-03-17 11:46:12 +04:00
Sebastiaan van Stijn
78f40c714e integration: 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
18c74abd56 *: modernize: slicescontains
go install golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest
    modernize -slicescontains -fix ./...

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

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

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 15:01:38 +01:00
Sebastiaan van Stijn
73e83de4b9 *: 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:49 +01:00
Fu Wei
589bf746c5 Merge pull request #12901 from dcantah/bump-cg-filterstats
Use new filtered cgroups stats API
2026-02-25 13:52:56 +00:00
Fabiano Fidêncio
871d58ca82 cri: unpack images with per-layer labels for runtime-specific snapshotters
Remote/proxy snapshotters like nydus need per-layer annotations on each
snapshot (cri.image-ref, cri.layer-digest, cri.manifest-digest,
cri.image-layers) so they can lazily fetch content inside the guest VM.
During a normal PullImage, these annotations are set by
AppendInfoHandlerWrapper and flow through the core/unpack.Unpacker to
each layer's Prepare/Commit call.

However, when an image is already present for one snapshotter (e.g.,
overlayfs) and needs to be used with a different one (e.g., nydus for
Kata), no pull occurs.  The image must be unpacked into the target
snapshotter with the correct per-layer labels.

Replace the image.Unpack() fallback in customopts.WithNewSnapshot with
unpackImage, which leverages the existing core/unpack.Unpacker and wraps
the image handler with AppendInfoHandlerWrapper when snapshot annotations
are enabled (!DisableSnapshotAnnotations).  This reuses the same unpack
machinery as PullImage, including retry handling, parallel layer
support, and deduplication.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
2026-02-24 20:03:51 +01:00
Michael Zappa
96dee5f644 add integration test for cni result nil
Signed-off-by: Michael Zappa <michael.zappa@gmail.com>
2026-02-20 08:54:55 -07:00
Danny Canter
d7d7b10f99 Use new filtered cgroup stats API
In some spots we can get away with only reading a subset of the cgroup
stats we are today. It would be reaaally nice for container stats in
the cri plugin, but they're requested via the task API and we have no
way to signify we only want a subset through this surface yet. We can
still get some benefit in the stats collector and the existing sandbox
stats where we only need mem and cpu.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2026-02-20 04:16:03 -08:00