Commit Graph

259 Commits

Author SHA1 Message Date
Jin Dong
cff8184ffb support image volume sub path
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2025-06-03 21:53:29 -04:00
Mike Brown
e393f41d20 Merge pull request #11823 from djdongjin/go-mod-1.24
Bump up go version to 1.24 and cri-api to 0.33.0
2025-05-27 20:43:13 +00:00
Maksym Pavlenko
909a5882d1 Merge pull request #11813 from jokemanfire/panic
fix(container_create): if sandboxConfig's metadata is nil will panic
2025-05-23 20:36:09 +00:00
Jin Dong
b9a29bdb99 ci: bump up go to 1.24.3
Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2025-05-23 19:36:58 +00:00
Mike Brown
7a3397d1e9 Merge pull request #11795 from mikebrow/reducing-k8s-vendor-footprint-executils
clones k8s util exec used by streaming code removing k8s util dependencies
2025-05-15 18:34:27 +00:00
Mike Brown
d498e690eb clones k8s util exec used by streaming code removing k8s util dependencies
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-15 16:34:09 +00:00
Mike Brown
6c0d36b24e follow-up changes discussed at end of review creating these packages
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-15 15:22:25 +00:00
Mike Brown
30be5e1793 Merge pull request #11840 from mikebrow/reducing-k8s-vendor-footprint-streaming
clones vendor of k8s.io/kubelet/pkg/cri/streaming
2025-05-14 21:50:01 +00:00
Mike Brown
7063ee6597 clones vendor of k8s.io/kubelet/pkg/cri/streaming
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-13 09:10:19 +00:00
ningmingxiao
a2f1f4a677 cri:use debug level when receive exec process exited events
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2025-05-12 09:58:09 +08:00
Chris Henzie
8d3eb65673 Update removal version for deprecated registry config fields
Config deprecations were postponed to 2.2:
https://github.com/containerd/containerd/pull/11684

Signed-off-by: Chris Henzie <chrishenzie@google.com>
2025-05-08 13:09:57 -07:00
jokemanfire
98698617c3 Update internal/cri/server/container_create.go
Co-authored-by: Jin Dong <djdongjin95@gmail.com>
Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-05-08 09:35:52 +08:00
jokemanfire
af05355e4b internal/container_create: if sandboxConfig's metadata is nil will panic
Avoid panic, if sandbox config's metadata is nil.

Signed-off-by: jokemanfire <hu.dingyang@zte.com.cn>
2025-05-08 09:33:50 +08:00
Sebastiaan van Stijn
bcfba26ca8 internal/cleanup: remove Background(), add tests for Do()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-07 13:06:57 +02:00
Sebastiaan van Stijn
ada7bdf19f replace "cleanup.Background" for "context.WithoutCancel"
the `cleanup.Background` utility was introduced in f606c4eba7,
at which time the project used go1.19, and Go's stdlib context did not yet
have [`context.WithoutCancel`], which was introduced in go1.21.

This patch replaces `cleanup.Background` for `context.WithoutCancel`, which
is near-identical, and part of go stdlib;

`cleanup.Background`:

    type clearCancel struct {
        context.Context
    }

    func (cc clearCancel) Deadline() (deadline time.Time, ok bool) {
        return
    }

    func (cc clearCancel) Done() <-chan struct{} {
        return nil
    }

    func (cc clearCancel) Err() error {
        return nil
    }

    // Background creates a new context which clears out the parent errors
    func Background(ctx context.Context) context.Context {
        return clearCancel{ctx}
    }

`context.WithoutCancel`:

    // WithoutCancel returns a derived context that points to the parent context
    // and is not canceled when parent is canceled.
    // The returned context returns no Deadline or Err, and its Done channel is nil.
    // Calling [Cause] on the returned context returns nil.
    func WithoutCancel(parent Context) Context {
        if parent == nil {
            panic("cannot create context from nil parent")
        }
        return withoutCancelCtx{parent}
    }

    type withoutCancelCtx struct {
        c Context
    }

    func (withoutCancelCtx) Deadline() (deadline time.Time, ok bool) {
        return
    }

    func (withoutCancelCtx) Done() <-chan struct{} {
        return nil
    }

    func (withoutCancelCtx) Err() error {
        return nil
    }

    func (c withoutCancelCtx) Value(key any) any {
        return value(c, key)
    }

    func (c withoutCancelCtx) String() string {
        return contextName(c.c) + ".WithoutCancel"
    }

[`context.WithoutCancel`]: https://pkg.go.dev/context@go1.21.0#WithoutCancel

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-07 12:34:59 +02:00
Sebastiaan van Stijn
c4435bb48e internal/cleanup: fix package godoc
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-05-07 12:33:31 +02:00
Fu Wei
3a1c2db95a Merge pull request #11793 from fuweid/carry-on-11761
[carry-11761] core/runtime: should invoke shim binary if it doesn't support Sandbox API
2025-05-06 22:37:07 +00:00
Wei Fu
e5ef65017d Revert "not set sandbox id when use podsandbox type"
This reverts commit 4b4e6f7c69.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2025-05-06 01:54:47 -04:00
Mike Brown
ddbd748a56 clones k8s apimachinery resource quantity for cri annotation parsing
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-05 17:01:58 +00:00
Phil Estes
c213879967 Merge pull request #11770 from azr/log-fetch-parameters
fix multipart layer fetch in client: pass config down
2025-05-05 12:51:17 +00:00
Adrien Delorme
e2d6a71605 cri: put limiter out of config
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-05-04 20:33:35 +02:00
Danny Canter
33ee060a35 Use Go 1.19 atomic wrappers everywhere
We've long been able to use these and they have a couple
great benefits:

1. Forces you to always access them atomically. With the pointer
variants it's completely valid to access the regular ol' int64/uint32
etc. without using the atomic.* methods. These wrappers don't provide
access to the underlying value so it forces correct usage always.

2. Conveys intent much better. Seeing the type be atomic.Int32 immediately
lets the reader know that this var will be used in a concurrent context,
and we no longer need comments like "this MUST be accessed atomically"
or similar.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2025-05-03 03:46:20 -07:00
Maksym Pavlenko
d549579917 Merge pull request #11788 from mikebrow/reducing-k8s-vendor-footpring-clock
clones k8s utils clock for cri server events to remove dependency on k8s/utils/clock internal utility
2025-05-03 04:15:50 +00:00
Mike Brown
9e67469fab clones k8s utils clock for cri server events to remove dependency
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-02 14:37:45 +00:00
Mike Brown
5f3f84f567 removes use of klog from containerd repo
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-02 13:34:46 +00:00
Maksym Pavlenko
949779fa4e Merge pull request #11780 from mikebrow/reducing-k8s-vendor-footprint-sets
cloning k8s apimachinery set utils no longer vendoring apimachinery
2025-05-02 06:08:54 +00: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
Mike Brown
8a08aebe1d removing/cloning vendor of kubelet pod label definitions
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2025-05-01 16:59:31 +00:00
Adrien Delorme
ca356e46ee cri: add a ConcurrentDownloadLimiter
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-30 10:20:26 +02:00
Adrien Delorme
a914597c0f fix: client pull: pass fetch performances options
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-30 10:20:26 +02:00
Krisztian Litkey
7c03dd0361 nri: add type conversion functions removed from NRI.
Use internal CRI resource conversion functions instead of
the ones which were recently dropped from core NRI to get
rid of a direct NRI dependency on CRI.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2025-04-25 18:03:03 +03:00
Adrien Delorme
72c8c7708c only keep one setting: concurrent_layer_fetch_buffer
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-24 11:41:33 +02:00
Adrien Delorme
024775dab1 set dl options on resolver
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-24 11:41:33 +02:00
Adrien Delorme
88116b1911 remove max_dl_operations setting
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
2025-04-24 11:39:42 +02:00
Adrien Delorme
f9af08820b perf(pull): multipart layer fetch
Signed-off-by: Adrien Delorme <azr@users.noreply.github.com>
Co-Authored-By: Corentin REGAL <143578+co42@users.noreply.github.com>
2025-04-24 11:39:42 +02:00
Derek McGowan
fad6366871 Merge pull request #11693 from thaJeztah/lazyregexp
use lazyregexp to compile regexes on first use
2025-04-24 00:39:41 +00:00
Derek McGowan
116b98704b Merge pull request #8515 from fangn2/cri-image-transfer
Update CRI to use transfer service for image pull by default
2025-04-23 22:58:12 +00:00
Samuel Karp
33232e7853 Merge pull request #11746 from chrishenzie/containerd-metrics
Revert criserver metrics subsystem back to cri
2025-04-23 21:57:47 +00:00
Chris Henzie
f57727c423 Revert criserver metrics subsystem back to cri
This was producing different metric names which can break metric
collection. Reverting to the previous "cri" subsystem so metrics are
consistent across 1.X and 2.X.

Signed-off-by: Chris Henzie <chrishenzie@google.com>
2025-04-23 13:15:19 -07:00
Maksym Pavlenko
1f70f07480 Merge pull request #11729 from dmcgowan/erofsutils-internal
Move erofsutils to internal
2025-04-23 19:26:25 +00:00
Tony Fang
b694be29a0 Update CRI image service to pull using transfer service
- adds a transfer service progress reporter to handle timeouts. Also other test fixes
- fallback to local image pull when configuration conflict

Signed-off-by: Tony Fang <nhfang@amazon.com>

Co-authored-by: Swagat Bora <sbora@amazon.com>
2025-04-23 18:18:27 +00:00
Sebastiaan van Stijn
1477874494 use lazyregexp to compile regexes on first use
- internal/cri/bandwidth: use lazyregexp to compile regexes on first use
- pkg/identifiers: use lazyregexp to compile regexes on first use
- pkg/progress: use lazyregexp to compile regexes on first use
- pkg/reference: use lazyregexp to compile regexes on first use
- pkg/sys: use lazyregexp to compile regexes on first use

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-22 20:29:14 +02:00
Sebastiaan van Stijn
fa0e50ccf2 implement lazyregexp package
Based on the "lazyregexp" package in golang.org/x/mod;
https://cs.opensource.google/go/x/mod/+/refs/tags/v0.19.0:internal/lazyregexp/lazyre.go;l=66-78

This package allows defining regular expressions that should not be
compiled until used, but still providing validation to prevent
invalid regular expressions from producing a panic at runtime.

The lazyregexp package provides a subset of the methods provided
by "regexp" and only implements the methods used in the codebase.
Additional methods can be added when needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-04-22 20:27:06 +02:00
yylt
4b4e6f7c69 not set sandbox id when use podsandbox type
Signed-off-by: yang yang <yang8518296@163.com>
2025-04-22 09:30:14 -07:00
Derek McGowan
98eded24b8 Move erofsutils to internal
Avoid introducing utils package outside of internal. This package
should not be imported by other modules.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-04-22 09:03:49 -07:00
Maksym Pavlenko
96fa56d3fd Merge pull request #11675 from klihub/fixes/main/nri-cdi-device-injection
cri,nri: add missing option to allow plugins to inject devices using CDI.
2025-04-21 16:48:27 +00:00
Maksym Pavlenko
adc1066168 Merge pull request #11092 from djdongjin/follow-hosts-header-in-docker-authorizer
Add cri headers and hosts.toml header to auth requests
2025-04-17 19:46:44 +00:00
Maksym Pavlenko
b39d644c7c Merge pull request #11612 from yylt/inc
[CRI] store extension when create sandbox in metadata store
2025-04-17 19:42:38 +00:00
Jin Dong
97eb1cd46f change criService.runtimeHandlers slice to a map
This patch changes `criService.runtimeHandlers` from
a slice to a map, so we don't need to for-loop slice
in `createContainer`.

It also refactors `introspectRuntimeHandler` a bit
so it can be called given a single `config.Runtime`.
This will help implement extracting runtime config
to separate files (https://github.com/containerd/containerd/issues/9296)

Signed-off-by: Jin Dong <djdongjin95@gmail.com>
2025-04-16 20:52:56 -04: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