Commit Graph
1068 Commits
Author SHA1 Message Date
Mike Brown 00ecad3d7a resolve lint issue upstreamcri.NewRemoteImageService() is deprecated
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2026-08-27 15:24:24 -05:00
Mike Brown ee09726316 fix for cri api Signal_ to Signal_SIGNAL_
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2026-08-27 15:24:24 -05:00
Maksym Pavlenko 051118d229 Merge pull request #14036 from mxpv/shim-telemetry
Pass tracing context from shim to runc and hooks
2026-08-27 18:35:45 +00:00
Wei Fu 24dc6900ec runtime: make task.Delete API retriable
To make task.Delete retriable, this patch caches the delete result in
memory after the shim successfully deletes the task. If a later shutdown
attempt fails, a subsequent Delete retry can complete cleanup and return the
cached exit information.

If containerd restarts after deleting the task, the in-memory cache is lost,
and containerd will publish TaskExit and TaskDelete events again to
subscribers. Currently, the exit status returned by shim-delete is always
137. In a follow-up, containerd-shim-runc-v2 should store the actual exit
status in the state directory, so that shim-delete can reuse it instead of
returning a hard-coded value.

Implements: #8981

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-08-26 18:10:43 -04:00
Maksym Pavlenko 0b4ed79573 integration: add e2e test to verify trace context propagation
Send a known trace context with the API call and assert that the
environment of the OCI hook runc executes carries it.

The shim propagates the context only when built with the shim_tracing
tag, so build the Linux integration job with it. The integration target
also has to pass the project build tags to the test compile, like the
other build targets already do.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2026-08-25 11:21:41 -07:00
Wei Fu 402eb3166e runtime: invoke Shutdown after every task deletion
TaskService.Shutdown may be invoked multiple times. A grouped shim
itself does not terminate while it still has active tasks. It terminates only
after receiving a Shutdown request when no active tasks remain.

The shim manager should invoke TaskService.Shutdown after deleting every task,
regardless of whether the task represents sandbox or not. This ensures that the
shim receives Shutdown when the last active task is deleted.

In CRI, the pause container uses oom_score_adj=-998, making it unlikely to be
OOM-killed. However, it may still exit or be killed before the other containers
in the sandbox. SandboxService.Shutdown and TaskService.Shutdown are independent
APIs. Sandbox service should make sure there is no active containers
before shutdown. So, for the task service, we should invoke Shutdown for
each task.

Removing the supportSandboxAPIVersion check does not change behavior for shims
using task API versions below v3. Those shims were already forced down the
non-sandboxed path and received Shutdown after every task deletion. The behavior
change applies only to sandboxed tasks using task API v3, which now receive
Shutdown after deletion as well.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2026-08-17 18:09:54 -04:00
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:
https://github.com/opencontainers/image-spec/blob/e72ae99d5fc74e7f7f8e320a44f76968da86a545/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