Commit Graph

11763 Commits

Author SHA1 Message Date
Samuel Karp
5cf6040cce
Merge pull request #7880 from kinvolk/rata/userns-stateless-pods 2022-12-30 00:18:15 -08:00
Iceber Gu
6b333fd210 ctr contents ls sorts the labels of the content
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-12-30 15:58:47 +08:00
Rodrigo Campos
3b48fb5b59 cri: Shadow variables to avoid t.Parallel() issues
This is a follow-up suggested by Fu Wei.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-12-29 18:16:20 -03:00
Mike Brown
66f186d42d
Merge pull request #7679 from kinvolk/rata/userns-stateless-pods
Add support for user namespaces in stateless pods (KEP-127)
2022-12-29 14:08:24 -06:00
Wei Fu
6b7e237fc7 chore: use go fix to cleanup old +build buildtag
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:25:14 +08:00
Derek McGowan
cfe7ac9956
Merge pull request #7529 from iyear/refactor-metastore-tx
Refactor metastore transaction
2022-12-28 20:08:38 -08:00
Derek McGowan
729206f6d0
Merge pull request #7874 from thaJeztah/appendOSMounts_error
oci: appendOSMounts(): remove unused error, and move
2022-12-28 20:04:06 -08:00
Akihiro Suda
ec67e05738
Merge pull request #7863 from pacoxu/v1.26-kube
add kube v1.26: remove v1alph2 cri support
2022-12-29 02:47:37 +09:00
iyear
1d0619bc0c Refactor metastore transaction
Signed-off-by: Junyu Liu <ljyngup@gmail.com>
2022-12-28 18:37:28 +08:00
Fu Wei
aee92eb46e
Merge pull request #7875 from yanggangtony/runc-version
make runc 1.1 for oss_fuzz_build.sh
2022-12-28 10:42:18 +08:00
Rodrigo Campos
ca69ae2656 Add integration tests for CRI userns
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-12-27 22:01:12 -03:00
Derek McGowan
27f43506b4
Merge pull request #7872 from yanggangtony/cri-sbserver
CRI sbserver: Prevent server reuse after Shutdown
2022-12-27 15:54:29 -08:00
Derek McGowan
ba243ffaaf
Merge pull request #7521 from iyear/fix-defer
Fix incorrect defer usage and refactor judgement
2022-12-27 15:50:41 -08:00
Fu Wei
4fe2d14e1b
Merge pull request #7869 from dcantah/domainname-oci
oci: Add WithDomainname
2022-12-27 19:18:12 +08:00
yanggang
09243e43ff
make runc 1.1 for oss_fuzz_build.sh
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-12-27 18:25:53 +08:00
Sebastiaan van Stijn
94c68aa001
oci: appendOSMounts(): remove unused error, and move
This function was added in ae22854e2b, but never
returned an error, and the error-return was not handled on the callsite. This
patch removes the unused error return, and moves it to a file related to mounts,
which allowed for some of the stubs to be removed and shared between non-FreeBSD
platforms.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-27 10:23:26 +01:00
Akihiro Suda
bae8fb9142
Merge pull request #7871 from yanggangtony/error-def
Reused errdefs define error
2022-12-27 18:07:18 +09:00
Paco Xu
d66afd2116 add kube v1.26: remove v1alpha2 cri support
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-12-27 14:57:06 +08:00
yanggang
e94d925711
CRI sbserver: Prevent server reuse after Shutdown.
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-12-27 14:16:40 +08:00
yanggang
b10536d64f
Reused errdefs define error
Signed-off-by: yanggang <gang.yang@daocloud.io>
2022-12-27 14:09:40 +08:00
Danny Canter
229779a4e5 oci: Add WithDomainname
A domainname field was recently added to the OCI spec. Prior to this
folks would need to set this with a sysctl, but now runtimes should be
able to setdomainname(2). There's an open change to runc at the moment
to add support for this so I've just left testing as a couple spec
validations in CRI until that's in and usable.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2022-12-26 04:03:45 -05:00
Fu Wei
3fefb98f99
Merge pull request #7866 from Iceber/ctr_tasks_kill
fix `ctr tasks kill` does not remove cni network under windows
2022-12-26 14:24:10 +08:00
Fu Wei
4c3eb5f0c3
Merge pull request #7858 from aojea/network_metrics 2022-12-26 09:03:16 +08:00
Kazuyoshi Kato
84b81a89ff
Merge pull request #7859 from dmcgowan/unpacker-warn-remove
Avoid using canceled context in unpacker cleanup
2022-12-23 08:11:53 -08:00
Antonio Ojea
ba0a7185f0 add network plugin metrics
Add network plugin metrics.

The metrics are the same that were used in dockershim/kubelet until
it was deprecated in kubernetes 1.23

https://github.com/kubernetes/kubernetes/blob/release-1.23/pkg/kubelet/dockershim/network/metrics/metrics.go

Signed-off-by: Antonio Ojea <aojea@google.com>
2022-12-23 09:23:56 +00:00
Iceber Gu
a2df12d1a3 fix ctr tasks kill does not remove cni network under windows
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-12-23 14:51:49 +08:00
Derek McGowan
6c8c427166
Merge pull request #7618 from changweige/enlarge-limit-key
image/label: print more characters of label keys
2022-12-22 17:26:26 -08:00
Derek McGowan
0bc9f7b545
Avoid using canceled context in unpacker cleanup
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-22 14:53:23 -08:00
Derek McGowan
b3b79813f3
Merge pull request #7165 from zouyee/nit
prevent Server reuse after a Shutdown
2022-12-22 14:09:29 -08:00
Samuel Karp
341a494c36
Merge pull request #7851 from kzys/critest-wait 2022-12-22 10:38:06 -08:00
Kazuyoshi Kato
b6df6708b9 Check containerd's readiness before calling critest
It was assuming containerd was ready right after starting.
But it depends GitHub actions' performance.

In addition to that, this commit extracts the script from ci.yml.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-12-22 16:29:12 +00:00
Samuel Karp
46b706ac55
Merge pull request #7837 from MarkintoshZ/main 2022-12-21 22:44:12 -08:00
Mark Zhang
a27e095480 Fix grammar and spelling mistakes in README
Signed-off-by: Mark Zhang <bf-109g2@hotmail.com>
2022-12-22 03:46:13 +00:00
Rodrigo Campos
a7adeb6976 cri: Support pods with user namespaces
This patch requests the OCI runtime to create a userns when the CRI
message includes such request.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-12-21 17:56:56 -03:00
Derek McGowan
c0c3546de4
Merge pull request #7636 from fangn2/fix-cpu-architecture-detection-issue-on-arm
Fix cpu architecture detection issue on linux/arm
2022-12-21 11:54:14 -08:00
David Leadbeater
31a6449734 Add capability for snapshotters to declare support for UID remapping
This allows user namespace support to progress, either by allowing
snapshotters to deal with ownership, or falling back to containerd doing
a recursive chown.

In the future, when snapshotters implement idmap mounts, they should
report the "remap-ids" capability.

Co-authored-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
Signed-off-by: David Leadbeater <dgl@dgl.cx>
2022-12-21 15:08:28 -03:00
Rodrigo Campos
36f520dc04 Let OCI runtime create netns when userns is used
As explained in the comments, this patch lets the OCI runtime create the
netns when userns are in use. This is needed because the netns needs to
be owned by the userns (otherwise can't modify the IP, etc.).

Before this patch, we are creating the netns and then starting the pod
sandbox asking to join this netns. This can't never work with userns, as
the userns needs to be created first for the netns ownership to be
correct.

One option would be to also create the userns in containerd, then create
the netns. But this is painful (needs tricks with the go runtime,
special care to write the mapping, etc.).

So, we just let the OCI runtime create the userns and netns, that
creates them with the proper ownership.

As requested by Mike Brown, the current code when userns is not used is
left unchanged. We can unify the cases (with and without userns) in a
future release.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2022-12-21 10:40:30 -03:00
Derek McGowan
47fee791f6
Add sandbox store plugin type
Moves the sandbox store plugin under the plugins packages and adds a
unique plugin type for other plugins to depend on it.
Updates the sandbox controller plugin to depend on the sandbox store
plugin.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-20 23:05:14 -08:00
Samuel Karp
3233d5d6f5
Merge pull request #7845 from dcantah/fix-noip-onrestart
Fixes https://github.com/containerd/containerd/issues/7843
2022-12-20 14:28:54 -08:00
Tony Fang
6e55234c38 Add unit test to function GetCPUVariantFromArch
Add unit test to function GetCPUVariantFromArch
Fix import issue on non-linux platforms
Fix some style issue

Signed-off-by: Tony Fang <nenghui.fang@gmail.com>
2022-12-20 22:00:12 +00:00
Tony Fang
8d5c045435 Use uname machine field to get CPU variant if fails at /proc/cpuinfo
When images/containers in ARM arch were built/executed on x86 host,
getCPUVariant will fail as it tries to look for /proc/cpuinfo, whose
content is from the host. Adding a new method as fallback to check uname
machine when it happens.

Signed-off-by: Tony Fang <nenghui.fang@gmail.com>
2022-12-20 21:59:32 +00:00
Derek McGowan
bd61843a25
Merge pull request #7081 from kzys/old-kernel
Enable checkRename test
2022-12-20 13:43:22 -08:00
Derek McGowan
8b3ed9f4ee
Merge pull request #7781 from dcantah/withtransaction
metastore: Add WithTransaction convenience method
2022-12-20 13:42:03 -08:00
Danny Canter
3ee6dd5c1b CRI: Fix no CNI info for pod sandbox on restart
Due to when we were updating the pod sandboxes underlying container
object, the pointer to the sandbox would have the right info, but
the on-disk representation of the data was behind. This would cause
the data returned from loading any sandboxes after a restart to have
no CNI result or IP information for the pod.

This change does an additional update to the on-disk container info
right after we invoke the CNI plugin so the metadata for the CNI result
and other networking information is properly flushed to disk.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2022-12-20 13:20:27 -08:00
Fu Wei
dd5605e444
Merge pull request #7831 from kzys/fix-race 2022-12-20 20:37:50 +08:00
Danny Canter
aa8a389c51 overlay snapshotter: Make use of WithTransaction
Move the overlay snapshotter over to using the WithTransaction convenience
method. This simplifies needing to check if we need to rollback a transaction
and saves us from needing to manually Commit ourselves.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2022-12-19 22:49:28 -08:00
Derek McGowan
2c573de6d3
Move snapshot event publishing into metadata store
Removes the snapshot event publishing from the snapshot service.

Adds an option to metadata db to add a publisher. Adds event
publishing to prepare, commit, and remove snapshot operations.
Adds remove snapshot event to garbage collection.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-12-19 17:05:28 -08:00
Kazuyoshi Kato
d5dd11dcdc Enable checkRename test
One of the cases wouldn't work on overlayfs, but other cases and/or
snapshotters should be tested.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-12-19 22:06:07 +00:00
Derek McGowan
8f7cfbda29
Merge pull request #7836 from AkihiroSuda/fix-7828
cri: fix `memory.memsw.limit_in_bytes: no such file or directory`
2022-12-18 22:12:55 -08:00
Akihiro Suda
4157503881
cri: fix memory.memsw.limit_in_bytes: no such file or directory
Skip automatic `if swapLimit == 0 { s.Linux.Resources.Memory.Swap = &limit }` when the swap controller is missing.
(default on Ubuntu 20.04)

Fix issue 7828 (regression in PR 7783 "cri: make swapping disabled with memory limit")

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-12-19 11:28:07 +09:00