Commit Graph

895 Commits

Author SHA1 Message Date
Derek McGowan
888fd315fd
Update CNI to v1.2.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-04-22 14:12:15 -07:00
Kirtana Ashok
5b6ae0f796 Use different containerd sock address in tests
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2024-03-27 19:04:48 -07:00
Akihiro Suda
5a23e8878c
Merge pull request #9917 from AkihiroSuda/mv-testutil
mv internal/testutil pkg/testutil
2024-03-12 12:01:16 +00:00
Maksym Pavlenko
6a96e45012
Move shim package to pkg
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-03-07 10:05:26 -08:00
Akihiro Suda
d9b9160ae1
mv internal/testutil pkg/testutil
The package is consumed by several snapshotter plugins

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-04 17:00:39 +09:00
Fu Wei
6333db7701
Merge pull request #9891 from dmcgowan/move-events-plugin
Move events to plugins and core
2024-02-29 12:45:25 +00:00
Fu Wei
2cdf012387
Merge pull request #9617 from abel-von/sandbox-plugin-0109
sandbox: use sandboxService in CRI plugin instead of calling controller API directly
2024-02-28 15:49:12 +00:00
Derek McGowan
72f21833b1
Move events to plugins and core
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-27 22:09:20 -08:00
Abel Feng
0f1d27412f sandbox: add methods to sandboxService
so that we cri service don't have to get sandbox controller everytime it
needs to call sandbox controller api.

Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-02-26 10:10:11 +08:00
Maksym Pavlenko
464319b3ab
Remove pause package from runc shim
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-22 11:42:16 -08:00
Akihiro Suda
fcdfd923cb
Merge pull request #8970 from cpuguy83/otel_off_by_default
Configure otel from env instead of config.toml
2024-02-22 04:57:50 +00:00
Brian Goff
4fbc9842d5 Changes to configuring otel from env only
These are standard environment variables described by the otel spec in
https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/.

The old config options are removed

Also since otel will by default try to connect to https://localhost:4318
if no endpoint is set, this will also just disable the otlp plugin when
there is no endpoint so we don't have otel continuously trying to
connect to the default endpoint, littering the logs with connection
failure messages and collecting traces that won't go anywhere.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2024-02-20 21:59:45 +00:00
Akhil Mohan
0693b936d2
replace deprecated Prestart to CreateRuntime hook
Prestart Hook is deprecated and can be replaced with CreateRuntime hook

Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
2024-02-20 21:54:47 +05:30
Samuel Karp
b87d78f456
Merge pull request #9765 from AkihiroSuda/remove-schema1
Disable the support for Schema 1 images
2024-02-17 09:20:15 +00:00
Phil Estes
0f5586ee09
Merge pull request #9748 from fuweid/upgrade-testcase
test: update upgrade test suite in integration
2024-02-16 16:11:25 +00:00
Wei Fu
c86c8a16f0 integration: add case related to ContainerStats in upgrade suite
It's used to check new release containerd can parse metric data from existing
shim created by previous release.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:38 +08:00
Wei Fu
acec60f554 integration: update recover case for upgrade
The new release containerd should detect dead shim during recover.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:38 +08:00
Wei Fu
e659cd2752 integration: connect to shim by bridge client
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:38 +08:00
Wei Fu
51689b6618 integration: introduce hook for upgrade test suite
We can inject failpoint in beforeUpgradeHookFunc.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:38 +08:00
Wei Fu
a95c8ed591 integration: check data dir after delete container or pod
The new release containerd should cleanup old pod's data dir after
RemovePodSandbox.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:38 +08:00
Wei Fu
ec759f5be4 integration/*: extend Runtime.Status response
CRI Runtime Status contains `Info` and it can help us check current
configuration.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:38 +08:00
Wei Fu
401d4b491f integration: add some helper function to release upgrade cases
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-02-16 12:18:30 +08:00
Maksym Pavlenko
7cf8a00c77
Run failpoints tests only for runc
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-15 12:19:31 -08:00
Akihiro Suda
99721c27e1
Disable 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).

We have planned to remove the support for Schema 1 in containerd v2.0, but this
removal may still surprise some users.
So, in containerd v2.0 we will just disable it by default.

The support for Schema 1 can be still enabled by setting an environment variable
`CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE=1`, however, this workaround
will be completely removed in containerd v2.1.

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>
2024-02-15 11:11:35 +09:00
Kirtana Ashok
4c775fcfbf Pass runtimehandler from CRI pull image request
Starting with k8s cri-api v0.29.1, CRI supports new runtime handler flag

Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2024-02-14 13:31:23 -08:00
Maksym Pavlenko
48c8c5f502 Remove ParseSignal from client
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-10 18:02:05 -08:00
Maksym Pavlenko
128f249f0e
Merge pull request #9790 from dmcgowan/mv-transfer-packages
Move transfer and unpack packages to core
2024-02-10 16:49:55 +00:00
Akihiro Suda
b466b7ef85
Merge pull request #9747 from AkihiroSuda/revert-9713
Revert "cri: make read-only mounts recursively read-only"
2024-02-08 10:29:03 +00:00
Derek McGowan
f46aea6187
Move transfer and unpack packages
Packages related to transfer and unpacking provide core interfaces which
use other core interfaces and part of common functionality.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-07 22:40:15 -08:00
Henry Wang
1eaf0c1f04 bug fix: make sure cri image is pinned when it is pulled outside cri
Signed-off-by: Henry Wang <henwang@amazon.com>
2024-02-07 16:03:40 +00:00
Fu Wei
de14037133
Merge pull request #9744 from klihub/devel/enable-nri-by-default
Flip NRI on by default.
2024-02-07 07:55:29 +00:00
Zoe
a9060cda4a Support inject delay running with the old version (4.x) of strace for test case.
Only the newer version of strace can support `--detach-on` options
and set time duration with human readable string.

In the 4.x version of strace, using `-b` to replace `--detach-on`,
and injecting a delay with int usecs.

Signed-off-by: Zoe <hi@zoe.im>
2024-02-05 21:27:41 +08:00
Krisztian Litkey
fe24b918f6
pkg/nri, docs: enable NRI by default.
Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2024-02-04 11:41:56 +02:00
Abel Feng
e230ed939c sandbox: add sandbox recover ut and e2e test
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-02-04 11:55:46 +08:00
Akihiro Suda
6670695836
Revert "cri: make read-only mounts recursively read-only"
Revert PR 9713, as it appeared to break the compatibility too much
https://github.com/kubernetes/enhancements/pull/3858#issuecomment-1925441072

This reverts commit b2f254fff0.

> Conflicts:
>	internal/cri/opts/spec_linux_opts.go

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-02-04 01:17:14 +09:00
Samuel Karp
96bf529cbf
Merge pull request #9742 from mxpv/envelope
Move Message proto to types
2024-02-03 06:32:01 +00:00
Maksym Pavlenko
7f2d2c4f44 Move Message proto to types
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 10:35:23 -08: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
Akihiro Suda
b2f254fff0
cri: make read-only mounts recursively read-only
Prior to this commit, `readOnly` volumes were not recursively read-only and
could result in compromise of data;
e.g., even if `/mnt` was mounted as read-only, its submounts such as
`/mnt/usbstorage` were not read-only.

This commit utilizes runc's "rro" bind mount option to make read-only bind
mounts literally read-only. The "rro" bind mount options is implemented by
calling `mount_setattr(2)` with `MOUNT_ATTR_RDONLY` and `AT_RECURSIVE`.

The "rro" bind mount options requires kernel >= 5.12, with runc >= 1.1 or
a compatible runtime such as crun >= 1.4.

When the "rro" bind mount options is not available, containerd falls back
to the legacy non-recursive read-only mounts by default.

The behavior is configurable via `/etc/containerd/config.toml`:
```toml
version = 2
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc]
  # treat_ro_mounts_as_rro ("Enabled"|"IfPossible"|"Disabled")
  # treats read-only mounts as recursive read-only mounts.
  # An empty string means "IfPossible".
  # "Enabled" requires Linux kernel v5.12 or later.
  # This configuration does not apply to non-volume mounts such as "/sys/fs/cgroup".
  treat_ro_mounts_as_rro = ""
```

Replaces:
- kubernetes/enhancements issue 3857
- kubernetes/enhancements PR 3858

Note: this change does not affect non-CRI clients such as ctr, nerdctl, and Docker/Moby.
RRO mounts have been supported since nerdctl v0.14 (containerd/nerdctl PR 511)
and Docker v25 (moby/moby PR 45278).

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-02-01 09:39:36 +09:00
Derek McGowan
d29a1bc6a0
Move sandbox info to cri types packages
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-28 20:57:19 -08:00
Derek McGowan
9795677fe9
Move cri base plugin to CRI runtime service
Create new plugin type for CRI runtime and image services.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-28 20:57:18 -08:00
Akihiro Suda
c1d59e38ef
Merge pull request #9661 from dmcgowan/update-cri-container-events-multisub
Add support for multiple subscribers to CRI container events
2024-01-27 15:57:30 +00:00
Derek McGowan
fb9b59a843
Switch to new errdefs package
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-25 22:18:45 -08:00
Maksym Pavlenko
7516bb915c
Merge pull request #9442 from AkihiroSuda/runtime-info2
api/services/instrospection: add PluginInfo
2024-01-25 17:50:42 +00:00
Derek McGowan
d5f7e54571
Merge pull request #9665 from fuweid/upgrade-recover-images
integration: add test for recovering images
2024-01-25 06:37:19 +00:00
Akihiro Suda
22d586e515
api/services/instrospection: add PluginInfo
The new `PlunginInfo()` call can be used for instrospecting the details
of the runtime plugin.

```console
$ ctr plugins inspect-runtime --runtime=io.containerd.runc.v2 --runc-binary=runc
{
    "Name": "io.containerd.runc.v2",
    "Version": {
        "Version": "v2.0.0-beta.0-XX-gXXXXXXXXX.m",
        "Revision": "v2.0.0-beta.0-XX-gXXXXXXXXX.m"
    },
    "Options": {
        "binary_name": "runc"
    },
    "Features": {
        "ociVersionMin": "1.0.0",
        "ociVersionMax": "1.1.0-rc.2",
        ...,
    },
    "Annotations": null
}
```

The shim binary has to support `-info` flag, see `runtime/v2/README.md`

Replaces PR 8509 (`api/services/task: add RuntimeInfo()`)

Co-authored-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-01-25 10:00:30 +09:00
Derek McGowan
f2765617c5
Merge pull request #9662 from dmcgowan/replace-platform-package
Use github.com/containerd/platforms package
2024-01-23 19:50:25 +00:00
Derek McGowan
e79ec7a095
Remove deprecated platforms package
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-01-23 09:14:03 -08:00
Wei Fu
748fe20358 integration: add test for recovering images
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-01-20 23:29:04 +08:00
Yury Gargay
2e8e03389c
Add multi-subscriber support to GetContainerEvents CRI API
This commit addresses issue #7318 by introducing events broadcasting
to the current implementation. The integration/container_event_test.go
is extended to demonstrate the broadcasting capabilities
of two simultaneous connected clients.

Signed-off-by: Yury Gargay <yury.gargay@gmail.com>
2024-01-19 21:27:06 -08:00