Commit Graph

12199 Commits

Author SHA1 Message Date
Fabiano Fidêncio
8d958b8c47
Merge pull request #8406 from microsoft/danmihai1/policy-doc
docs: add agent policy documentation
2023-11-10 17:19:04 +01:00
James O. D. Hunt
f588d31324
Merge pull request #8374 from jodh-intel/kata-manager-check-dl-url-count
utils: kata-manager: Ensure only one download URL
2023-11-10 13:19:07 +00:00
Fabiano Fidêncio
b0157ad73a runtime: confidential: Do not set the max_vcpu to cpu
We don't have to do this since we're relying on the
`static_sandbox_resource_mgmt` feature, which gives us the correct
amount of memory and CPUs to be allocated.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-10 12:58:20 +01:00
Steve Horsman
b23952c852
Merge pull request #8309 from gkurz/update-release-process-doc
Update release process documentation
2023-11-10 09:44:18 +00:00
James O. D. Hunt
0ead018d0a utils: kata-manager: Add Docker details to list output
Add Docker version details to the output of the list versions
CLI option.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 09:19:56 +00:00
James O. D. Hunt
be3044fd01 utils: kata-manager: Add option to list versions
Add a command-line option to list the installed and available versions
of Kata and containerd.

Fixes: #8355.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 09:19:56 +00:00
James O. D. Hunt
9969f5a94a utils: kata-manager: Make test container name more unique
Rather than creating a container called `test-kata`, prefix with the
script name to make it a bit "more unique" and less likely for users to
have an existing container with the test container name. The new test
container name is `kata-manager-sh-test-kata`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 09:19:56 +00:00
James O. D. Hunt
436d7d1275 utils: kata-manager: Improve usage message
Update the usage to show that the latest Kata version can also be queried using
`kata-ctl`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:29:14 +00:00
James O. D. Hunt
1625a5ce48 utils: kata-manager: Improve version check
Update `github_get_latest_release()` to use `sort -V` rather than
sub-sorting on the major, minor and patch level version number elements.

The new approach is safer and more accurate.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:29:14 +00:00
James O. D. Hunt
c72a27e219 utils: kata-manager: Ensure only one download URL
Add an extra sanity check to ensure that only a single download URL is
found for the specified release version.

Fixes: #8364.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:27:23 +00:00
James O. D. Hunt
839f6c3d44 utils: kata-manager: Improve info messages
Improve some of the information messages a little by adding
more detail and quoting file names.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-10 08:27:20 +00:00
Archana Shinde
21e45bebc8
Merge pull request #8376 from fidencio/topic/kata-manager-add-support-for-docker-installation
kata-manager: Add support for Docker CLI installation
2023-11-09 22:11:50 -08:00
Chao Wu
a62fb83c91
Merge pull request #8169 from openanolis/chao/fix_typo_shm
runtime-rs: fix a typo in shm
2023-11-10 14:00:11 +08:00
Chao Wu
820b578aa3
Merge pull request #8370 from gaohuatao-1/bugfix
agent: update AGENT_THREADS metrics value
2023-11-10 13:16:29 +08:00
gaohuatao
78df1bb851 agent: update AGENT_THREADS metrics value
Fixes: #8369

Signed-off-by: gaohuatao <gaohuatao@bytedance.com>
2023-11-10 10:39:57 +08:00
Chao Wu
afb002c25c runtime-rs: fix a typo in shm
is_shim_volume should be is_shm_volume in shm_volume mod.

fixes: #8168
Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
2023-11-10 10:36:58 +08:00
Fabiano Fidêncio
2b937400fe
Merge pull request #8404 from fidencio/topic/kata-deploy-allow-users-to-enable-hypervisor-annotations
kata-deploy: Allow users to set hypervisor annotations
2023-11-09 17:44:52 +01:00
Dan Mihai
bc49c553ef docs: add agent policy documentation
Add initial agent policy documentation.

Fixes: #7671

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2023-11-09 16:43:00 +00:00
Fabiano Fidêncio
5d10aed9ba kata-manager: Make containerd_config a global var
As "/etc/containerd/config.toml" is used from more than one place, let's
just make it a global var.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 13:47:52 +01:00
Fabiano Fidêncio
66d1b2c173 kata-manager: Add support for docker installation
Add support for also installing the Docker CLI, giving users the chance
to try Kata Containers with docker in the same way we provide users the
chance to try Kata Containers with `ctr`.

Fixes: #8357

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 13:47:52 +01:00
Fabiano Fidêncio
1a81989d20 tests: k8s: Use the "ALLOWED_HYPERVISOR_ANNOTATIONS"
The current kata-deploy code has been doing a `sed` to add allowed
hypervisor annotations, so CBL mariner can be tested with their own
kernel and initrd.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 13:42:31 +01:00
Fabiano Fidêncio
023c4a17cf kata-deploy: Allow users to set hypervisor annotations
Currently the only way one can specify allowed hypervisor annotations is
during build time, which is a big issue for users grabbing kata-deploy
as we provide.

Fixes: #8403

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 13:42:31 +01:00
Fabiano Fidêncio
0352f1e029 kata-manager: Allow passing a specific tool to test_installation
Right now we're only testing with `ctr` and there's no change in
behaviour with this commit.  However, allowing to pass a tool to run the
tests with gives us an easier time when expanding kata-manager to
support, for instance, docker and nerdctl.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 11:24:37 +01:00
Fabiano Fidêncio
50df1129ea
Merge pull request #8411 from fidencio/topic/fix-k3s-deployment
gha: Fix regex used to get kubectl version from the k3s version
2023-11-09 10:44:34 +01:00
Fabiano Fidêncio
455b7bf776 gha: k3s: Avoid unnecessary escape
There's no reason to escape the first + on the +k3s[0-9]\+ regex, as
shown here:
```sh
ubuntu@k3s:~$ /usr/local/bin/k3s kubectl version --short 2>/dev/null | \
	grep "Client Version" | \
	sed \
		-e 's/Client Version: //' \
		-e 's/+k3s[0-9]\+//'
v1.27.7
```

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 08:42:25 +01:00
Fabiano Fidêncio
e7890ee8f6 gha: Fix regex used to get kubectl version from the k3s version
It seems that with the new k3s release, they've bumped their kubectl
version from x.y.z+k3s1 to x.y.z+k3s2.

Let's ensure our regexp is more generic and future proof for such
changes.

Fixes: #8410

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-09 07:08:02 +01:00
Archana Shinde
1611723465
Merge pull request #8379 from likebreath/1103/clh_v36.0
Upgrade to Cloud Hypervisor v36.0
2023-11-08 21:10:41 -08:00
Archana Shinde
268d4d622f
Merge pull request #8389 from justxuewei/vm-capable-test
runtime: Fix TestCheckHostIsVMContainerCapable unstablity issue
2023-11-08 12:14:04 -08:00
Archana Shinde
92a517156c
Merge pull request #8367 from amshinde/add-nerdctl-ipvlan-test
network: Fix network hotplug for ipvlan and macvlan endpoints for qemu and add tests
2023-11-08 11:45:13 -08:00
Chelsea Mafrica
83e731328f
Merge pull request #8023 from cmaf/runtime-rs-ch-pause-resume
runtime-rs: Update status for pause and resume
2023-11-08 11:34:47 -08:00
Hyounggyu Choi
84b5618733 tests|gha: add internal nightly tests for s390x
This is to add a workflow for internal nightly tests for s390x in Jenkins.

Fixes: #7986
Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-11-08 16:07:41 +01:00
Xuewei Niu
acd9057c7b runtime: Fix TestCheckHostIsVMContainerCapable unstablity issue
TestCheckHostIsVMContainerCapable removes sysModuleDir to simulate a
case that the kernel modules are not loaded. However,
checkKernelModules() executes modprobe <module> if a module not
found in that directory. Loading those modules is required to be denied
temporarily.

Fixes: #8390

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 22:40:08 +08:00
Fupan Li
100a73d2fd
Merge pull request #7531 from justxuewei/device-cgroup
agent: Restrict device access at upper node of container's cgroup
2023-11-08 22:01:48 +08:00
Chao Wu
4435c1efd7
Merge pull request #8386 from jodh-intel/runtime-rs-ch-tidy-up
runtime-rs: ch: Simplify VSOCK error handling
2023-11-08 17:31:40 +08:00
Xuewei Niu
023d8dc01e agent: Changes according to Pan's comments
- Disable device cgroup restriction while pod cgroup is not available.
- Remove balcklist-related names and change whitelist-related names to
  allowed_all.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 09:39:08 +08:00
Xuewei Niu
136fb76222 tests: Add a integrated test for device cgroup
`TestDeviceCgroup` is added to cri-containerd's integration tests. The test
launches two containers. Each container has a block device. It checks the
validity of device cgroup.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 09:39:07 +08:00
Xuewei Niu
b5f3a8cb39 agent: Fix container launching failure with systemd cgroup
FSManager of systemd cgroup manager is responsible for setting up cgroup
path. The container launching will be failed if the FSManager is in
read-only mode.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 09:39:07 +08:00
Xuewei Niu
6477825195 agent: Minor changes according to Zhou's comments
The changes include:

- Change to debug logging level for resources after processed.
- Remove a todo for pod cgroup cleanup.
- Add an anyhow context to `get_paths_and_mounts()`.
- Remove code which denys access to VMROOTFS since it won't take effect. If
  blackmode is in use, the VMROOTFS will be denyed as default. Otherwise,
  device cgroups won't be updated in whitelist mode.
- Add a unit test for `default_allowed_devices()`.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 09:39:07 +08:00
Xuewei Niu
cec8044744 agent: Make devcg_info optional for LinuxContainer::new()
The runk is a standard OCI runtime that isnt' aware of concept of sandbox.
Therefore, the `devcg_info` argument of `LinuxContainer::new()` is
unneccessary to be provided.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 09:39:07 +08:00
Xuewei Niu
ef4c3844a3 agent: Restrict device access at upper node of container's cgroup
The target is to guarantee that containers couldn't escape to access extra
devices, like vm rootfs, etc.

Assume that there is a cgroup, such as `/A/B`. The `B` is container cgroup,
and the `A` is what we called pod cgroup. No matter what permissions are
set for the container (`B`), the `A`'s permission is always `a *:* rwm`. It
leads that containers could acquire permission to access to other devices
in VM that not belongs to themselves.

In order to set devices cgroup properly, the order of setting cgroups is
that the pod cgroup comes first and the container cgroup comes after.

The `Sandbox` has a new field, `devcg_info`, to save cgroup states. To
avoid setting container cgroup too early, an initialization should be done
carefully. `inited`, one of the states, is a boolean to indicate if the pod
cgroup is initialized. If no, the pod cgroup should be created firstly, and
set default permissions. After that, the pause container cgroup is created
and inherits the permissions from the pod cgroup.

If whitelist mode which allows containers to access all devices in VM is
enabled,  then device resources from OCI spec are ignored.

This feature not supports systemd cgroup and cgroup v2, since:

- Systemd cgroup implemented on Agent hasn't supported devices subsystem so
  far, see: https://github.com/kata-containers/kata-containers/issues/7506.
- Cgroup v2's device controller depends on eBPF programs, which is out of
  scope of cgroup.

Fixes: #7507

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-08 09:39:07 +08:00
Archana Shinde
c075fa6817 tests: Add test with nerdctl to verify macvlan support
Add test to verify kata supports macvlan networks.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2023-11-07 10:13:51 -08:00
Archana Shinde
07db673eb9 tests: Add test with nerdctl to verify ipvlan support
Add test to verify kata supports ipvlan networks.
This test can be bit tricky as it requires knowledge about host interfaces
to be used as a master for the ipvlan network.
However, with github actions, we can assume interface called eth0 to be
present on the host and functioning.

Fixes: #8366

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2023-11-07 10:13:51 -08:00
Archana Shinde
a6272733e7 network: Fix network hotplug for ipvlan and macvlan endpoints.
Since moving from network coldplug to hotplug, the only case verified
was veth endpoints. Support for network hotplug for ipvlan and macvlan was
broken/not added. Fix it.

Fixes: #8391

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2023-11-07 10:13:51 -08:00
James O. D. Hunt
59d0d4caff runtime-rs: ch: Simplify VSOCK error handling
Remove the redundant `VmConfigError::EmptyVsockSocketPath` error from
the Cloud Hypervisor config crate since this scenario is already handled
by the `VsockConfigError::NoVsockSocketPath` error.

Fixes: #8385.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-07 17:45:38 +00:00
James O. D. Hunt
bdb83f8282 runtime-rs: ch: Remove unused function
Remove the redundant `parse_mac()` function: this was never used and we
already have an implementation in `crates/resource/src/network/utils/mod.rs`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-07 17:45:38 +00:00
Wainer Moschetta
949ac4d810
Merge pull request #8217 from beraldoleal/issues/8216
tests: fixes permission denied when running test
2023-11-07 12:25:23 -03:00
Wainer Moschetta
7f5d70f48b
Merge pull request #8061 from beraldoleal/gogo-removal-v3
Updating containerd to a GogoProtobuf free version
2023-11-07 12:18:50 -03:00
Xuewei Niu
8ea87405ed runtime-rs: Remove virtio config from Backend
Virtio-net and vhost-net share a common virtio config, and vhost-user-net
uses another config, named `VhostUserConfig`. Thus, the virtio config could
be added into `NetworkConfig` instead of `Backend`.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-07 19:35:02 +08:00
Xuewei Niu
ad66378bf5 runtime-rs: Move Dragonball stuff out of device drivers
Moving Dragonball structs convertions out of device drivers to keep driver
neutral. The convertions include `NetworkBackend` to
`DragonballNetworkBackend` and `NetworkConfig` to
`DragonballNetworkConfig`.

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-07 19:35:02 +08:00
Xuewei Niu
3e0614cdf0 dragonball: Minor changes to comments
Changes include:

- Merge `VhostNetDeviceError` import item.
- Replace if with match in `add_vhost_net_device()`

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2023-11-07 19:35:02 +08:00