Commit Graph

16352 Commits

Author SHA1 Message Date
Steve Horsman
1c718dbcdd
Merge pull request #11506 from stevenhorsman/remove-atty-dependency
Remove atty dependency
2025-07-04 10:46:28 +01:00
Alex Lyn
362ea54763
Merge pull request #11517 from zvonkok/fix-nvrc-build
gpu: NVRC static build
2025-07-04 13:51:03 +08:00
Alex Lyn
2e35a8067d
Merge pull request #11482 from Apokleos/fix-force-guestpull
runtime-rs:  refactor and fix the implementation of guest-pull
2025-07-04 11:29:33 +08:00
stevenhorsman
6f23608e96 ci: Remove atty group
atty is unmaintained, with the last release almost 3 years
ago, so we don't need to check for updates, but instead will
remove it from out dependency tree.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-04 09:43:34 +08:00
stevenhorsman
7ffbdf7b3a mem-agent: Remove structopts crate
structopt features were integrated into clap v3 and so is not
actively updated and pulls in the atty crate which has a security
advisory, so update clap, remove structopts, update the code that
used it to remove the outdated dependencies.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-04 09:43:34 +08:00
stevenhorsman
7845129bdc versions: Bump slog-term to 2.9.1
slog-term 2.9.0 included atty, which is unmaintained
as has a security advisory GHSA-g98v-hv3f-hcfr,
so bump the version across our components to remove
this dependency.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-07-04 09:43:34 +08:00
Aurélien Bombo
fe532f9d04
Merge pull request #11475 from kata-containers/sprt/zizmor-fixes
security: ci: Fixes for Zizmor GHA security scanning
2025-07-03 13:29:47 -05:00
Zvonko Kaiser
c3b2d69452 gpu: NVRC static build
We had the proper config.toml configuration for static builds
but were building the glibc  target and not the musl target.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-07-03 15:31:00 +00:00
Aurélien Bombo
8723eedad2 gha: Remove path restriction for Zizmor workflow
The way GH works, we can only require Zizmor results on ALL PR runs, or
none, so remove the path filter.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2025-07-03 08:18:34 -05:00
Alex Lyn
c857f59a1a
Merge pull request #11510 from lifupan/sync_resize_vcpu
runtime-rs: make the resize_vcpu api support sync
2025-07-03 17:35:08 +08:00
alex.lyn
2b95facc6f kata-type: Relax Mandatory source Field Check in Guest-Pull Mode
Previously, the source field was subject to mandatory checks. However,
in guest-pull mode, this field doesn't consistently provide useful
information. Our practical experience has shown that relying on this
field for critical data isn't always necessary.

In other aspect, not all cases need mandatory check for KataVirtualVolume.
based on this fact, we'd better to make from_base64 do only one thing and
remove the validate(). Of course, We also keep the previous capability to
make it easy for possible cases which use such method and we rename it
clearly with from_base64_and_validate.

This commit relaxes the mandatory checks on the KataVirtualVolume specifically
for guest-pull mode, acknowledging its diminished utility in this context.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-03 17:07:20 +08:00
alex.lyn
8f8b196705 runtime-rs: refactor merging metadata within image_pull
refactor implementation for merging metadata.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-03 17:07:08 +08:00
Fupan Li
fb1c35335a runtime-rs: make the resize_vcpu sync
When hot plugging vcpu in dragonball hypervisor, use the synchronization
interface and wait until the hot plug cpu is executed in the guest
before returning. This ensures that the subsequent device hot plug will
not conflict with the previous call.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-03 15:11:36 +08:00
Fupan Li
72a38457f0 dragonball: make the resize_vcpu api support sync
Let dragonball's resize_vcpu api support synchronization, and only
return after the hot-plug of the CPU is successfully executed in the
guest kernel. This ensures that the subsequent device hot-plug operation
can also proceed smoothly.

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2025-07-03 15:11:36 +08:00
Alex Lyn
210844ce6b
Merge pull request #11509 from teawater/agent_test
kata-agent: mount.rs: Fix warning of test
2025-07-03 15:05:04 +08:00
Alex Lyn
95d513b379
Merge pull request #11423 from zhaodiaoer/test
test: fix broken testing code in libs
2025-07-03 11:15:39 +08:00
teawater
0347698c59 kata-agent: mount.rs: Fix warning of test
Got follow warning with make test of kata-agent:
   Compiling rustjail v0.1.0 (/data/teawater/kata-containers/src/agent/rustjail)
   Compiling kata-agent v0.1.0 (/data/teawater/kata-containers/src/agent)
warning: unused import: `std::os::unix::fs`
    --> rustjail/src/mount.rs:1147:9
     |
1147 |     use std::os::unix::fs;
     |         ^^^^^^^^^^^^^^^^^
     |
     = note: `#[warn(unused_imports)]` on by default

This commit fixes it.

Fixes: #11508

Signed-off-by: teawater <zhuhui@kylinos.cn>
2025-07-03 10:01:19 +08:00
alex.lyn
7a59d7f937 runtime-rs: Import the public const value from libs
Introduce a const value `KATA_VIRTUAL_VOLUME_PREFIX` defined in the libs/kata-types,
and it'll be better import such const value from there.

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-03 09:42:17 +08:00
Aurélien Bombo
8d86bcea4b
Merge pull request #11499 from kata-containers/sprt/fix-commit-check
gha: Eliminate use of force-skip-ci label
2025-07-02 10:53:55 -05:00
Aurélien Bombo
8d7d859e30 gha: Eliminate use of force-skip-ci label
This was originally implemented as a Jenkins skip and is only used in a few
workflows.  Nowadays this would be better implemented via the gatekeeper.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2025-07-02 10:29:50 -05:00
Saul Paredes
e7b9eddced
Merge pull request #11248 from microsoft/archana1/storages
genpolicy: add validation for storages
2025-07-01 10:02:10 -07:00
Fabiano Fidêncio
07b41c88de
Merge pull request #11490 from Apokleos/fix-noise
runtime-rs: Fix noise with frequently appearing in unstaged changes
2025-07-01 17:43:41 +02:00
Archana Choudhary
6932beb01f policy: fix parse errors in rules.rego
This patch fixes the rules.rego file to ensure that the
policy is correctly parsed and applied by opa.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 12:43:41 +00:00
Archana Choudhary
abbe1be69f tests: enable confidential_guest setting for coco
This commit updates the `tests_common.sh` script
to enable the `confidential_guest`
setting for the coco tests in the Kubernetes
integration tests.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
9dd365fdb5 genpolicy: fix mount source check in rules.rego
This commit fixes the mount source check in rules.rego.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
1cbea890f1 genpolicy: tests: update testcases for execprocess
This patch removes storages from the testcases.json file for execprocess.
This is because input storage objects are invalid for two reasons:
1. "io.katacontainers.fs-opt.layer=" is missing option in annotations.
2. by default, we don't have host-tarfs-dm-verity enabled, so the storage
objects are not created in policy.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
---
2025-07-01 10:35:20 +00:00
Archana Choudhary
6adec0737c genpolicy: add rules for image_guest_pull storage
This patch introduces some basic checks for the
`image_guest_pull` storage type in the genpolicy tool.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
bd2dc1422e genpolicy: add test for container images having volumes
This patch adds a test case to genpolicy for container images that have volumes.
Examples of such container images include:
 - quay.io/opstree/redis
 - https://github.com/kubernetes/examples/blob/master/cassandra/image/Dockerfile

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
d7f998fbd5 genpolicy: tests: update test for emptydir volumes
This patch
  - updates testcases.json for emptydir volumes/storages

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
68c8c31718 genpolicy: tests: add test for config_map volumes
This patch adds test for config_map volumes.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
9ebbc08d70 genpolicy: enable storage checks
This patch
 - adds condition to add container image layers as storages
 - enable storage checks
 - fix CI policy test cases
 - update genpolicy-settings.json to enable storage checks
 - remove storage object addition in container image parsing

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Archana Choudhary
5b1459e623 genpolicy: test framework: enable config map usage
This patch improves the test framework for the
genpolicy tool by enabling the use of config maps.

Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2025-07-01 10:35:20 +00:00
Alex Lyn
8784cebb84
Merge pull request #10693 from Apokleos/guest-pullimage-timeout
runtime-rs: support setting create_container timeout with request_timeout_ms for image pulling in guest
2025-07-01 11:40:19 +08:00
alex.lyn
b7c1d04a47 runtime-rs: Fix noise with frequently appearing in unstaged changes
Fixes #11489

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-07-01 10:19:02 +08:00
alex.lyn
9839c17cad build: add Makefile variable for create_container_timeout
Add the definiation of variable DEFCREATECONTAINERTIMEOUT into
Makefile target with default timeout 30s.

Fixes: #485

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-30 20:04:56 +08:00
alex.lyn
1a06bd1f08 kata-types: Introduce annotation *_RUNTIME_CREATE_CONTAINTER_TIMEOUT
It's used to indicate timeout value set for image pulling in
guest during creating container.
This allows users to set this timeout with annotation according to the
size of image to be pulled.

Fixes #10692

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-30 20:04:56 +08:00
alex.lyn
f886e82f03 runtime-rs: support setting create_container_timeout
It allows users to set this create container timeout within
configuration.toml according to the size of image to be pulled
inside guest.

Fixes #10692

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-30 20:04:56 +08:00
alex.lyn
ce524a3958 kata-types: Give a more comprehensive definition of request_timeout_ms
To better understand the impact of different timeout values on system
behavior, this section provides a more comprehensive explanation of the
request_timeout_ms:

This timeout value is used to set the maximum duration for the agent to
process a CreateContainerRequest. It's also used to ensure that workloads,
especially those involving large image pulls within the guest, have sufficient
time to complete.
Based on explaination above, it's renamed with `create_container_timeout`,
Specially, exposed in 'configuration.toml'

Fixes #10692

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2025-06-30 20:04:56 +08:00
Steve Horsman
f04bb3f34c
Merge pull request #11479 from stevenhorsman/skip-weekly-coco-stability-tests
workflows: Skip weekly coco stability tests
2025-06-30 09:05:14 +01:00
Fabiano Fidêncio
b024d8737c
Merge pull request #11481 from fidencio/topic/fix-passing-image-size-alignment
build: Allow passing IMAGE_SIZE_ALIGNMENT_MB as an env var
2025-06-30 09:04:39 +02:00
Alex Lyn
69d2c078d1
Merge pull request #11484 from stevenhorsman/bump-nydus-snapshotter-0.15.2
version: Bump nydus-snapshotter
2025-06-30 14:44:01 +08:00
Alex Lyn
e66baf503b
Merge pull request #11474 from Apokleos/remote-annotation
runtime-rs: Add GPU annotations for remote hypervisor
2025-06-30 14:05:15 +08:00
Fabiano Fidêncio
8d4e3b47b1
Merge pull request #11470 from fidencio/topic/runtime-rs-fix-odd-memory-size-calculation
runtime-rs: Fix calculation of odd memory sizes
2025-06-30 07:26:30 +02:00
Champ-Goblem
91cadb7bfe runtime-rs: Fix calculation of odd memory sizes
An odd memory size leads to the runtime breaking during its startup, as
shown below:
```
Warning  FailedCreatePodSandBox  34s   kubelet            Failed to
create pod sandbox: rpc error: code = Unknown desc = failed to start
sandbox
"708c81910f4e67e53b4170b6615083339b220154cb9a0c521b3232cdb40d50f9":
failed to create containerd task: failed to create shim task:
Others("failed to handle message start sandbox in task handler\n\nCaused
by:\n    0: start vm\n    1: set vm base config\n    2: set vm
configuration\n    3: Failed to set vm configuration VmConfigInfo {
vcpu_count: 2, max_vcpu_count: 16, cpu_pm: \"on\", cpu_topology:
CpuTopology { threads_per_core: 1, cores_per_die: 1, dies_per_socket: 1,
sockets: 1 }, vpmu_feature: 0, mem_type: \"shmem\", mem_file_path: \"\",
mem_size_mib: 4513, serial_path:
Some(\"/run/kata/708c81910f4e67e53b4170b6615083339b220154cb9a0c521b3232cdb40d50f9/console.sock\"),
pci_hotplug_enabled: true }\n    4: vmm action error:
MachineConfig(InvalidMemorySize(4513))\n\nStack backtrace:\n   0:
anyhow::error::<impl anyhow::Error>::msg\n   1:
hypervisor::dragonball::vmm_instance::VmmInstance::handle_request\n   2:
hypervisor::dragonball::vmm_instance::VmmInstance::set_vm_configuration\n
3: hypervisor::dragonball::inner::DragonballInner::set_vm_base_config\n
4: <hypervisor::dragonball::Dragonball as
hypervisor::Hypervisor>::start_vm::{{closure}}::{{closure}}\n   5:
<hypervisor::dragonball::Dragonball as
hypervisor::Hypervisor>::start_vm::{{closure}}\n   6:
<virt_container::sandbox::VirtSandbox as
common::sandbox::Sandbox>::start::{{closure}}::{{closure}}\n   7:
<virt_container::sandbox::VirtSandbox as
common::sandbox::Sandbox>::start::{{closure}}\n   8:
runtimes::manager::RuntimeHandlerManager::handler_task_message::{{closure}}::{{closure}}\n
9:
runtimes::manager::RuntimeHandlerManager::handler_task_message::{{closure}}\n
10: <service::task_service::TaskService as
containerd_shim_protos::shim::shim_ttrpc_async::Task>::create::{{closure}}\n
11: <containerd_shim_protos::shim::shim_ttrpc_async::CreateMethod as
ttrpc::asynchronous::utils::MethodHandler>::handler::{{closure}}\n  12:
<tokio::time::timeout::Timeout<T> as
core::future::future::Future>::poll\n  13:
ttrpc::asynchronous::server::HandlerContext::handle_msg::{{closure}}\n
14: <core::future::poll_fn::PollFn<F> as
core::future::future::Future>::poll\n  15:
<ttrpc::asynchronous::server::ServerReader as
ttrpc::asynchronous::connection::ReaderDelegate>::handle_msg::{{closure}}::{{closure}}\n
16: tokio::runtime::task::core::Core<T,S>::poll\n  17:
tokio::runtime::task::harness::Harness<T,S>::poll\n  18:
tokio::runtime::scheduler::multi_thread::worker::Context::run_task\n
19: tokio::runtime::scheduler::multi_thread::worker::Context::run\n  20:
tokio::runtime::context::runtime::enter_runtime\n  21:
tokio::runtime::scheduler::multi_thread::worker::run\n  22:
<tokio::runtime::blocking::task::BlockingTask<T> as
core::future::future::Future>::poll\n  23:
tokio::runtime::task::core::Core<T,S>::poll\n  24:
tokio::runtime::task::harness::Harness<T,S>::poll\n  25:
tokio::runtime::blocking::pool::Inner::run\n  26:
std::sys::backtrace::__rust_begin_short_backtrace\n  27:
core::ops::function::FnOnce::call_once{{vtable.shim}}\n  28:
std::sys::pal::unix:🧵:Thread:🆕:thread_start")
```

As we cannot control what the users will set, let's just round it up to
the next acceptable value.

Signed-off-by: Champ-Goblem <cameron@northflank.com>
Signed-off-by: Fabiano Fidêncio <fidencio@northflank.com>
2025-06-28 14:29:18 +02:00
Fabiano Fidêncio
e2b93fff3f build: Allow passing IMAGE_SIZE_ALIGNMENT_MB as an env var
This helps considerably to avoid patching the code, and just adjusting
the build environment to use a smaller alignment than the default one.

Signed-off-by: Fabiano Fidêncio <fidencio@northflank.com>
2025-06-28 00:05:20 +02:00
stevenhorsman
fe5d43b4bd workflows: Skip weekly coco stability tests
These tests are not passing, or being maintained,
so as discussed on the AC meeting, we will skip them
from automatically running until they can be reviewed
and re-worked, so avoid wasting CI cycles.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-06-27 16:51:53 +01:00
stevenhorsman
61b12d4e1b version: Bump nydus-snapshotter
Bump to version v0.15.2 to pick up fix to mount source in
https://github.com/containerd/nydus-snapshotter/pull/636

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2025-06-27 14:04:00 +01:00
RuoqingHe
a43e06e0eb
Merge pull request #11461 from stevenhorsman/bump-guest-components-4cd62c3
versions: Bump guest-components
2025-06-27 10:45:06 +08:00
Aurélien Bombo
d94085916e ci: set Zizmor as required test
This adds Zizmor GHA security scanning as a PR gate.

Note that this does NOT require that Zizmor returns 0 alerts, but rather
that Zizmor's invocation completes successfully (regardless of how many
alerts it raises).

I will set up the former after this commit is merged (through the GH UI).

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2025-06-26 12:36:41 -05:00
Aurélien Bombo
820c1389db security: ci: remove overly broad permission
This removes the permission from the workflow since it's already present
at the job level.

https://github.com/kata-containers/kata-containers/security/code-scanning/111

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2025-06-26 12:29:23 -05:00