Commit Graph

318 Commits

Author SHA1 Message Date
Maksym Pavlenko
6f34da5f80 Cleanup logrus imports
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-05-05 11:54:14 -07:00
Brad Davidson
27f56e607f
Fix umarshal metrics for CRI server
Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
2023-05-03 20:50:04 +00:00
Derek McGowan
a7ceac8b63
Merge pull request #8337 from keloyang/imagePullThroughput
Register imagePullThroughput and count with MiB
2023-05-02 10:30:19 -07:00
Kirtana Ashok
d9f3e387c6 Remove entry for container from container store on error
If containerd does not see a container but criservice's
container store does, then we should try to recover from
this error state by removing the container from criservice's
container store as well.

Signed-off-by: Kirtana Ashok <Kirtana.Ashok@microsoft.com>
2023-04-25 16:32:22 -07:00
Wei Fu
4192ca8f8c pkg/cri/server: sub-test uses array and capture range var
Using array to build sub-tests is to avoid random pick. The shuffle
thing should be handled by go-test framework. And we should capture
range var before runing sub-test.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-04-16 16:47:02 +08:00
Shingo Omura
dc2fc987ca
capture desc variable in range variable just in case that it run in parallel mode
Signed-off-by: Shingo Omura <everpeace@gmail.com>
2023-04-10 20:59:11 +09:00
Shingo Omura
05bb52b273
Use t.TempDir instead of os.MkdirTemp
Signed-off-by: Shingo Omura <everpeace@gmail.com>
2023-04-10 20:58:36 +09:00
Fu Wei
5885db62c8
Merge pull request #8136 from everpeace/fix-additiona-gids-to-read-image-user
[CRI] fix additionalGids: it should fallback to imageConfig.User when securityContext.RunAsUser,RunAsUsername are empty
2023-04-09 14:59:07 +08:00
Shukui Yang
db223271e3 Register imagePullThroughput and count with MiB
Signed-off-by: Shukui Yang <yangshukui@bytedance.com>
2023-04-07 10:12:41 +08:00
Samuel Karp
8f756bc8c2
Merge pull request #8309 from vinayakankugoyal/fixresolv
Add noexec nodev and nosuid to sandbox /etc/resolv.conf mount bind.
2023-03-30 17:34:08 -07:00
Vinayak Goyal
990199a021 Test to ensure nosuid,nodev,noexec are set on /etc/reolv.conf mount.
Signed-off-by: Vinayak Goyal <vinaygo@google.com>
2023-03-29 20:34:05 +00:00
Maksym Pavlenko
a11e47b48c Use built in atomic.Bool
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-27 12:08:06 -07:00
Vinayak Goyal
ae4dbb60d5 Add noexec nodev and nosuid to sandbox /etc/resolv.conf mount bind.
Signed-off-by: Vinayak Goyal <vinaygo@google.com>
2023-03-24 21:56:53 +00:00
Fu Wei
584d13d5cb
Merge pull request #8276 from Iceber/remove_cri_v1alpha2
Remove CRI v1alpha2 [deprecated since v1.7]
2023-03-22 13:25:07 +08:00
Iceber Gu
c011502bd1 Remove cri v1alpha1 services
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-03-16 17:48:49 +08:00
Danny Canter
62f98a1c11 CRI: Don't always close netConfMonitor channel
In the CRI server initialization a syncgroup is setup that adds to the
counter for every cni config found/registered. This functions on platforms
where CNI is supported/theres an assumption that there will always be
the loopback config. However, on platforms like Darwin where there's generally
nothing registered the Wait() on the syncgroup returns immediately and the
channel used to return any Network config sync errors is closed. This channel
is one of three that's used to monitor if we should Close the CRI service in
containerd, so it's not great if this happens.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-03-15 20:01:17 -07:00
Maksym Pavlenko
c5f1086adf Update docs
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:22:15 -07:00
Maksym Pavlenko
8bd82e355a Remove no_pivot when creating container from CRI
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:16 -07:00
Maksym Pavlenko
07c2ae12e1 Remove v1 runctypes
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:16 -07:00
Shingo Omura
50740a1a0c
use strings.Cut instead of strings.Split for parsing imageConfig.User
Signed-off-by: Shingo Omura <everpeace@gmail.com>
2023-03-14 13:52:03 +09:00
Akihiro Suda
c77ddf5381
Merge pull request #8131 from lucacome/bump-k8s.io-deps
Bump k8s.io deps
2023-03-07 21:44:13 +09:00
Fu Wei
5ae3a7f417
Merge pull request #8198 from kiashok/argsEscapedSupportInCri
Add ArgsEscaped support for CRI
2023-03-07 16:12:24 +08:00
Kevin Parsons
31c9a66385
Merge pull request #7099 from jsturtevant/cri-only-stats-windows
[cri] Implement CRI Pod and Container stats for Windows
2023-03-06 09:31:41 -08:00
James Sturtevant
08aa576a95
Add Windows Sandbox Stats
Signed-off-by: James Sturtevant <jstur@microsoft.com>
2023-03-03 14:37:38 -08:00
Kirtana Ashok
8137e41c48 Add ArgsEscaped support for CRI
This commit adds supports for the ArgsEscaped
value for the image got from the dockerfile.
It is used to evaluate and process the image
entrypoint/cmd and container entrypoint/cmd
options got from the podspec.

Signed-off-by: Kirtana Ashok <Kirtana.Ashok@microsoft.com>
2023-03-03 13:38:06 -08:00
Wei Fu
5946c1051e *: fix code style issue
1. it's easy to check wrong input if using drain_exec_sync_io_timeout in error
2. avoid to use full error message, as part of error generated by go
   stdlib would be changed in the future
3. delete the extra empty line

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-03 17:51:03 +08:00
Wei Fu
ffebcb1223 cri: disable drain-exec-IO if it is empty timeout
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-03 11:59:07 +08:00
Wei Fu
3c18decea7 *: add DrainExecSyncIOTimeout config and disable as by default
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-03 00:21:55 +08:00
Wei Fu
a9cbddd65d *: fix typo and skip exec-io-drain-testcase in win
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-02 21:57:43 +08:00
Luca Comellini
f25ec98d0d
Fix linting error sets.String is deprecated
Signed-off-by: Luca Comellini <luca.com@gmail.com>
2023-03-01 21:37:30 -08:00
Wei Fu
82c0f4ff86 pkg/cri/server: add timeout to drain exec io
By default, the child processes spawned by exec process will inherit standard
io file descriptors. The shim server creates a pipe as data channel. Both exec
process and its children write data into the write end of the pipe. And the
shim server will read data from the pipe. If the write end is still open, the
shim server will continue to wait for data from pipe.

So, if the exec command is like `bash -c "sleep 365d &"`, the exec process is
bash and quit after create `sleep 365d`. But the `sleep 365d` will hold the
write end of the pipe for a year! It doesn't make senses that CRI plugin
should wait for it.

For this case, we should use timeout to drain exec process's io instead of
waiting for it.

Fixes: #7802

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2023-03-02 13:06:45 +08:00
Ed Bartosh
49abbe4f2b fix failing TestCDIInjections
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2023-02-22 20:07:34 +02:00
Shingo Omura
727b254039
fix userstr for dditionalGids on Linux
It should fallback to imageConfig.User when no securityContext.RunAsUser/RunAsUsername

Signed-off-by: Shingo Omura <everpeace@gmail.com>
2023-02-19 22:09:00 +09:00
Derek McGowan
179f00c883
Merge pull request #8051 from yulng/goroutine
fix: 'go routine' should be 'goroutine'
2023-02-15 15:20:47 -08:00
Derek McGowan
aa6418fadd
Merge pull request from GHSA-hmfx-3pcx-653p
oci: fix additional GIDs
2023-02-15 13:45:14 -08:00
Kazuyoshi Kato
fe5d1d3e7c
Merge pull request #7954 from klihub/devel/sbserver-nri-integration
pkg/cri/sbserver: experimental NRI integration for CRI.
2023-02-15 10:42:25 -08:00
Maksym Pavlenko
3548f59fd8
Merge pull request #8060 from dcantah/cri-annots-other
CRI: Pass sandbox annotations to _other platforms
2023-02-14 18:34:46 -08:00
Casey Callendrello
0166783c79 cni: pass in the cgroupPath capability argument
There is a new CNI capability argument, cgroupPath, where runtimes can
pass cgroup paths to CNI plugins.

Implement that.

Signed-off-by: Casey Callendrello <cdc@isovalent.com>
2023-02-14 16:49:29 +01:00
Danny Canter
646bc3a94e CRI: Create DefaultCRIAnnotations helper
All of the CRI sandbox and container specs all get assigned
almost the exact same default annotations (sandboxID, name, metadata,
container type etc.) so lets make a helper to return the right set for
a sandbox or regular workload container.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-13 13:05:01 -08:00
Danny Canter
5aab634e14 CRI: Pass sandbox annotations to _other platforms
!windows and !linux weren't getting passed the sandbox annotations.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-13 13:03:51 -08:00
Krisztian Litkey
8a1dca0f4a pkg/cri: split out NRI API from pkg/cri/server.
Split out the criService-agnostic bits of nri-api* from
pkg/cri/server to pkg/cri/nri to allow sharing a single
implementation betwen the server and sbserver versions.
Rework the interfaces to not require access to package
internals.

Signed-off-by: Krisztian Litkey <krisztian.litkey@intel.com>
2023-02-13 22:05:45 +02:00
Derek McGowan
edb8ebaf07
Merge pull request #8047 from ruiwen-zhao/send_nil
Send container events with nil PodSandboxStatus
2023-02-13 11:38:14 -08:00
Derek McGowan
164ac924f8
Merge pull request #7984 from aitumik/aitumik/add-host-network-tests
test: add hostNetwork tests for both windows and linux
2023-02-13 11:37:20 -08:00
Fu Wei
2654ece1d0
Merge pull request #8066 from fuweid/cleanup-blockio-init
*: introduce wrapper pkgs for blockio and rdt
2023-02-13 14:05:32 +08:00
Derek McGowan
c6cf6b2522
Merge pull request #8093 from mxpv/instrument
Extract CRI instrument into separate package
2023-02-12 21:45:13 -08:00
Maksym Pavlenko
750d18aced Extract CRI instrument package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-02-12 20:49:15 -08:00
Fu Wei
040fcf85f0
Merge pull request #8091 from dcantah/mirror-generic-toml-change 2023-02-12 11:23:34 +08:00
Akihiro Suda
b61988670c
go.mod: github.com/containerd/typeurl/v2 v2.1.0
Changes: https://github.com/containerd/typeurl/compare/7f6e6d160d67...v2.1.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-11 23:39:52 +09:00
Danny Canter
74b371b98a CRI: Mirror generic toml runtime config under server
In https://github.com/containerd/containerd/pull/7764 it was made
so that generic runtime options in the containerd toml config file
would get passed to shims regardless of if containerd knew of the
type beforehand and could supply the struct. However, this was only
added for the sandbox server fork here and not the regular ol' CRI
server. This change just mirrors the parts that need to be plopped in
pkg/cri/server

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-02-11 05:18:52 -08:00
ruiwen-zhao
51a8db233d Send container events with nil PodSandboxStatus
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2023-02-11 01:34:39 +00:00