Commit Graph
20 Commits
Author SHA1 Message Date
Ayato Tokubi 47c7085d22 cri: add streaming RPCs
Add server-streaming variants of CRI list RPCs (StreamContainers,
StreamPodSandboxes, StreamContainerStats, StreamPodSandboxStats,
StreamPodSandboxMetrics, StreamImages) that send results in batches
of 5000 items.

Signed-off-by: Ayato Tokubi <atokubi@redhat.com>
2026-07-23 09:57:59 -05:00
Ben Cressey 0ec1af4cae Do not propagate reserved labels from image configs
Image config labels are copied onto the container by both the CRI
plugin (BuildLabels) and the client's WithImageConfigLabels option
used by `ctr run`. Labels in the containerd.io/* namespace are
interpreted by containerd itself and labels in the io.cri-containerd*
namespace are interpreted by the CRI plugin. An image config is not a
trusted source for labels in either namespace.

Skip labels in both reserved namespaces when copying labels from an
image config to a container, and warn about each label skipped: an
image that tries to set them may be attempting to alter containerd
behavior. Oversized image labels are already skipped this way by
the CRI plugin.

Labels set explicitly by clients, for example via `ctr run --label`
or in the CRI request, are unaffected.

Verified with the CRI plugin and with `ctr run` against an image
whose config carries labels like these: the labels are no longer
present on the created container and a warning is logged for each.

Assisted-by: Claude Code
Signed-off-by: Ben Cressey <ben@cressey.org>
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2026-06-10 13:18:24 -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
Mike Brown 3411f16668 Merge pull request #13031 from thaJeztah/rm_deprecated
internal/cri/setutils: remove unused, deprecated utils
2026-03-17 14:38:26 +00:00
Sebastiaan van Stijn be7846652c internal/cri/util: replace uses of deprecated String set
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-03-15 19:06:53 +01:00
Sebastiaan van Stijn 26c2ae5900 internal: 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 656c48f0e5 internal: 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:05 +01:00
Andrey Noskov 3e2cee2bf1 fix: redact all query parameters in CRI error logs
Signed-off-by: Andrey Noskov <andreyn@microsoft.com>
2025-11-19 11:13:47 +01:00
Wei Fu c9afcc2bce cri: retry stop container if there is connection closed
In critest, a lot of containers will exit automatically. It could be
race condition between event handler and StopPodSandbox goroutines. The
StopPodSandbox could encounter `ttrpc: closed` error. It's retryable. To
fix flaky CI issue, add new function as wrapper to retry stopContainer
call.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2025-10-24 13:40:57 -04:00
Mike Brown 42937de92a cloning k8s apimachinery set utils no longer vendoring apimachinery
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-01 23:22:21 +00:00
Akihiro Suda d9c889568e Remove the support for Schema 1 images
Schema 1 (`application/vnd.docker.distribution.manifest.v1+prettyjws`) has been
officially deprecated since containerd v1.7 (PR 6884), and disabled since v2.0 (PR 9765).

Users who have been seeing warnings like `conversion from schema 1 images is deprecated`
now have to rebuild the image with Schema 2 or OCI.

Schema 2 was introduced in Docker 1.10 (Feb 2016), so most users should have been already
using Schema 2 or OCI.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2025-04-11 09:03:26 +09:00
ningmingxiao 7c522819d2 support to set defer cleanup timeout to decrease ctx timeout
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-03-15 11:01:56 +08:00
Jin Dong 71958731e8 move security profile to cri/sputil pkg
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2025-02-20 19:15:58 +00:00
luchenhan 740c5d4284 docs: fix some function names in comment
Signed-off-by: luchenhan <hanluchen@aliyun.com>
2025-01-14 11:36:35 +08:00
Austin Vazquez bee64b2b93 Remove loop variable copies
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
2024-12-23 23:14:49 -07:00
Jin Dong 38ba7f2f7e dedup BuildLabels
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-10-21 13:23:25 -04:00
Jin Dong a5cd0d0a5c dedup GetPassthroughAnnotations
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-10-21 11:35:00 -04:00
Jin Dong 269997ac5a dedup GetRepoDigestAndTag
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-10-21 11:24:31 -04:00
Jin Dong f61dbc2d02 dedup ParseImageReferences
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2024-10-21 11:17:09 -04:00
Maksym Pavlenko bbac058cf3 Move CRI from pkg/ to internal/
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 10:12:08 -08:00