Commit Graph

89 Commits

Author SHA1 Message Date
Maksym Pavlenko
0b02e0c225
Merge pull request #7616 from swagatbora90/trace-cri-runtime
Add tracing spans to CRI runtime service apis
2024-08-09 18:24:47 +00:00
Sebastiaan van Stijn
9776047243
migrate to github.com/moby/sys/userns
Commit 8437c567d8 migrated the use of the
userns package to the github.com/moby/sys/user module.

After further discussion with maintainers, it was decided to move the
userns package to a separate module, as it has no direct relation with
"user" operations (other than having "user" in its name).

This patch migrates our code to use the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-08 12:48:54 +02:00
Swagat Bora
83c26962c2 Remove extra span created in the instrumented service layer
Signed-off-by: Swagat Bora <sbora@amazon.com>
2024-08-05 02:34:27 +00:00
Swagat Bora
c0cdcb34f1 Add spans to CRI runtime service and related client methods
This adds otel spans to CRI service mainly targeting mutating apis which includes:
* Sandbox apis - RunPodSandbox, StopPodSandbox, RemovePodSandbox
* Container apis - CreateContainer, StartContainer, StopContainer, RemoveContainer
* Attach, Exec and Exec Sync
* Containerd client methods: container.go, client.go, process.go and task.go

Signed-off-by: Swagat Bora <sbora@amazon.com>
2024-08-05 02:34:20 +00:00
Maksym Pavlenko
fec24e209d
Merge pull request #10520 from saschagrunert/cri
Make `StopPodSandbox` RPC idempotent
2024-07-30 20:12:50 +00:00
Sascha Grunert
a97b11898a
Make StopContainer RPC idempotent
Similar to container removal, the stop of a container should be a noop if
the container has not been found.

Found during: https://github.com/kubernetes-sigs/cri-tools/pull/1536

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-07-30 11:47:25 +02:00
Sascha Grunert
c6cea95d95
Make StopPodSandbox RPC idempotent
Similar to sandbox removal, the stop of a sandbox should be a noop if
the sandbox has not been found.

Found during: https://github.com/kubernetes-sigs/cri-tools/pull/1535

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-07-30 10:40:16 +02:00
Sebastiaan van Stijn
8437c567d8
pkg/userns: deprecate and migrate to github.com/moby/sys/user/userns
The userns package in libcontainer was integrated into the moby/sys/user
module at commit [3778ae603c706494fd1e2c2faf83b406e38d687d][1].

This patch deprecates the containerd fork of that package, and adds it as
an alias for the moby/sys/user/userns package.

[1]: 3778ae603c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-26 09:47:50 +02:00
Shingo Omura
ee2c0d9e74
KEP-3619: implement features.supplemental_groups_policy in RuntimeStatus
Signed-off-by: Shingo Omura <everpeace@gmail.com>
2024-07-23 01:01:36 +09:00
Eric Lin
807f32573f cri: optimize ListPodSandboxStats with parallelism
Signed-off-by: Eric Lin <linxiulei@gmail.com>
2024-07-12 09:02:33 +00:00
Maksym Pavlenko
ac0f34f0ec
Merge pull request #10378 from akhilerm/use-marshall-from-type-url
use typeurl funcs for marshalling anypb.Any
2024-07-11 16:15:20 +00:00
Davanum Srinivas
0772d0a37b
Fix for [cri] ttrpc: closed during ListPodSandboxStats
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-07-10 20:42:06 -04:00
Akhil Mohan
300fd770a0
use typeurl funcs for marshalling anypb.Any
Signed-off-by: Akhil Mohan <akhilerm@gmail.com>
2024-07-10 22:26:27 +05:30
Fu Wei
1fb1882c7d
Merge pull request #10375 from linxiulei/podstats
cri: get pid count from container metrics
2024-07-01 21:32:17 +00:00
Samuel Karp
ebcbbe5643
Merge pull request #10401 from samuelkarp/nri-panic
cri: ensure NRI API never has nil CRI
2024-07-01 16:37:46 +00:00
Eric Lin
f6e731c809 cri: get pid count from container metrics
This reduces latency of calling ListPodSandboxStats() by avoiding calling
shim API Task().

Signed-off-by: Eric Lin <linxiulei@gmail.com>
2024-07-01 15:34:47 +00:00
Fu Wei
f5f11658c5
Merge pull request #9903 from abel-von/add-update-resource-only
sandbox: Add Update API for sandbox controller
2024-07-01 15:16:21 +00:00
Samuel Karp
10aec359a0
cri: ensure NRI API never has nil CRI
A nil CRIImplementation field can cause a nil pointer dereference and
panic during startup recovery.

Prior to this change, the nri.API struct would have a nil cri
(CRIImplementation) field after nri.NewAPI until nri.Register was
called.  Register is called mid-way through initialization of the CRI
plugin, but recovery for containers occurs prior to that.  Container
recovery includes establishing new exit monitors for existing containers
that were discovered.  When a container exits, NRI plugins are given the
opportunity to be notified about the lifecycle event, and this is done
by accessing that CRIImplementation field inside the nri.API.  If a
container exits prior to nri.Register being called, access to the
CRIImplementation field can cause a panic.

Here's the call-path:

* The CRI plugin starts running
  [here](ae71819c4f/pkg/cri/server/service.go (L222))
* It then [calls into](ae71819c4f/pkg/cri/server/service.go (L227))
  `recover()` to recover state from previous runs of containerd
* `recover()` then attempts to recover all containers through
  [`loadContainer()`](ae7d74b9e2/internal/cri/server/restart.go (L175))
* When `loadContainer()` finds a container that is still running, it waits
  for the task (internal containerd object) to exit and sets up
  [exit monitoring](ae7d74b9e2/internal/cri/server/restart.go (L391))
* Any exit that then happens must be
  [handled](ae7d74b9e2/internal/cri/server/events.go (L145))
* Handling an exit includes
  [deleting the Task](ae7d74b9e2/internal/cri/server/events.go (L188))
  and specifying [`nri.WithContainerExit`](ae7d74b9e2/internal/cri/nri/nri_api_linux.go (L348))
  to [notify](ae7d74b9e2/internal/cri/nri/nri_api_linux.go (L356))
  any subscribed NRI plugins
* NRI plugins need to know information about the pod (not just the sandbox),
  so before a plugin is notified the NRI API package
  [queries the Sandbox Store](ae7d74b9e2/internal/cri/nri/nri_api_linux.go (L232))
  through the CRI implementation
* The `cri` implementation member field in the `nri.API` struct is set as part of the
  [`Register()`](ae7d74b9e2/internal/cri/nri/nri_api_linux.go (L66)) method
* The `nri.Register()` method is only called
  [much further down in the CRI `Run()` method](ae71819c4f/pkg/cri/server/service.go (L279))

Signed-off-by: Samuel Karp <samuelkarp@google.com>
2024-06-28 15:32:11 -07:00
Sebastiaan van Stijn
dd0542f7c1
cmd: don't alias context package, and use cliContext for cli.Context
Unfortunately, this is a rather large diff, but perhaps worth a one-time
"rip off the bandaid" for v2. This patch removes the use of "gocontext"
as alias for stdLib's "context", and uses "cliContext" for uses of
cli.context.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-20 02:15:13 +02:00
Abel Feng
15887d7efc sandbox: add update api for controller
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-06-14 02:31:51 +00:00
Mike Brown
98ebb3ecff
Merge pull request #9737 from everpeace/kep-3169-SupplementalGroupsPolicy
KEP-3619: Fine-grained SupplementalGroups control
2024-06-13 16:59:20 +00:00
Reinhard Tartler
09d3e20d3a Allow running test in usernamespace
Debian has started building packages with usernamespaces
to disable network access and similar isolation features. The
containerd package executes a unit test that fails in that
scenario, see https://bugs.debian.org/1070411

The code contains a conditional on whether it is running in
usernamepsace. This commit expands the unit test to cover
this behavior; it was previously untested.

The easiest way to reproduce this issue is to prefix the test
invocaiton with 'unshare -nr go test [...]'

Signed-off-by: Reinhard Tartler <siretart@gmail.com>
2024-06-12 00:36:54 +00:00
Shingo Omura
8bcffa9446
KEP-3619: Fine grained SupplementalGroups control
Signed-off-by: Shingo Omura <everpeace@gmail.com>
2024-06-12 09:10:40 +09:00
Akihiro Suda
1529259077
Merge pull request #10275 from dmcgowan/imgcrypt-revendor
Re-enable imgcrypt
2024-05-29 16:54:47 +00:00
Fu Wei
5d2c988a5a
Merge pull request #10201 from abel-von/retry-remote-sandbox-wait
sandbox: do retry for wait to remote sandbox controller
2024-05-29 00:00:29 +00:00
Derek McGowan
da1d9672f6
Enable imgcrypt in cri pull
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-28 13:50:06 -07:00
Maksym Pavlenko
6383a1ce76
Merge pull request #10258 from bzsuni/bz/update/pause
update pause image to 3.10
2024-05-28 18:01:23 +00:00
Sebastiaan van Stijn
446e63579c
remove uses of platforms.Platform alias
Commit 3c8469a782 removed uses of the api
types.Platform type from public interfaces, instead using the type from
the OCI image spec.

For convenience, it also introduced an alias in the platforms package.
While this alias allows packages that already import containerd's
platforms package (now a separate module), it may also cause confusion
(it's not clear that it's an alias for the OCI type), and for packages
that do not depend on containerd's platforms package / module may now
be resulting in an extra dependency.

Let's remove the use of this alias, and instead use the OCI type directly.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-05-28 14:56:30 +02:00
bzsuni
22f2af40c0 update pause image to 3.10
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-05-25 08:17:46 +08:00
Mike Brown
87bab6cdc7
Merge pull request #10238 from MikeZappa87/feature/provideinternalloup
Add support to set loopback to up
2024-05-20 14:19:43 +00:00
Michael Zappa
332caf1a15 Provide ability to set lo up without CNI
Signed-off-by: Michael Zappa <michael.zappa@gmail.com>
2024-05-17 14:34:55 -06:00
Kazuyoshi Kato
24c2ae8115
Merge pull request #10026 from ningmingxiao/info_exited_event
internal/cri: log ctr's exit event on info level
2024-05-17 01:28:43 +00:00
Kazuyoshi Kato
ff66ec7a73
Merge pull request #10105 from fidencio/topic/fix-typos-in-image_pull_test.go
images: tests: Fix typos in the tests
2024-05-17 01:27:46 +00:00
Abel Feng
7cead88004 cri: restart created container with correct io type
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-05-13 17:42:58 +08:00
Abel Feng
58be881890 sandbox: do retry for wait to remote sandbox controller
remote sandbox controller may restart, the Wait call should be retried
if it is an grpc disconnetion error.

Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-05-10 10:18:42 +08:00
Fu Wei
313fc12b8a
Merge pull request #9965 from abel-von/streaming-io
cri: support io by streaming API
2024-05-07 14:22:12 +00:00
Abel Feng
b8dfb4d8f5 cri: support io by streaming api
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-05-07 20:26:40 +08:00
Phil Estes
04c7d6ccbf
Merge pull request #9960 from adrianreber/2024-03-12-criu-not-found
Return correct error if CRIU binary is missing
2024-05-06 19:41:38 +00:00
Derek McGowan
2ac2b9c909
Make api a Go sub-module
Allow the api to stay at the same v1 go package name and keep using a
1.x version number. This indicates the API is still at 1.x and allows
sharing proto types with containerd 1.6 and 1.7 releases.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-02 11:03:00 -07:00
Derek McGowan
e1b94c0e7d
Move protobuf package under pkg
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-02 10:52:03 -07:00
Derek McGowan
4a45507772
Move runc options to api directory
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-05-02 10:52:00 -07:00
Abel Feng
de38490ed6 sandbox: merge address and protocol to one url
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-04-30 15:28:00 +08:00
Abel Feng
c3b306240e add task api endpoint in task create options
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-04-30 15:22:44 +08:00
Abel Feng
b1fefccc78 sandbox: store endpoint in cri sandboxStore
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-04-30 15:20:03 +08:00
Akihiro Suda
c27bcdc564
cri: introspectRuntimeFeatures: fix nil panic
Fix issue 10062

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-04-25 08:36:38 +09:00
Derek McGowan
1412a255ec
Merge pull request #10068 from kiashok/portForwardingWindows-ipv6
Account for ipv6 localhost in windows port forwarding
2024-04-22 21:14:18 +00:00
Fabiano Fidêncio
9ee3bfaba2
images: tests: Fix typos in the tests
This is a non-functional change, that fixes the following typos:
* Snashotter -> Snapshotter
* expectSnapshotter -> expectedSnapshotter
* expectErr -> expectedErr
* exiting-runtime -> existing-runtime

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-04-22 21:04:49 +02:00
Kirtana Ashok
7e60d5a074 Account for ipv4 vs ipv6 localhost
in windows port forwarding

Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
2024-04-19 11:30:49 -07:00
Maksim An
c7ea06a69b fix default working directory hostProcess
Per https://github.com/kubernetes/enhancements/tree/master/keps/sig-windows/1981-windows-privileged-container-support#container-mounts
the default working directory for `hostProcess` containers should
be `C:\hpc`, however the current default is set to windows default
which is `C:\`.

Signed-off-by: Maksim An <maksiman@microsoft.com>
2024-04-11 23:35:55 -07:00
Phil Estes
99693a32c2
Merge pull request #10041 from elezar/bump-container-device-interface-v0.7.1
Bump tags.cncf.io/container-device-interface to v0.7.1
2024-04-11 15:33:21 +00:00