Commit Graph

4749 Commits

Author SHA1 Message Date
Zvonko Kaiser
9162103f85 agent: Update macro for e.g. String type
stack-only types are handled properly with the
parse_cmdline_param macro advancted types like
String couldn't be guarded by a guard function since
it passed the variable by value rather than reference.

Now we can have guard functions for the String type

parse_cmdline_param!(
    param,
    CGROUP_NO_V1,
    config.cgroup_no_v1,
    get_string_value,
    | no_v1 | no_v1 == "all"
);

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-01-27 17:56:43 +00:00
Zvonko Kaiser
aab9d36e47 agent: Add tests for cgroup_no_v1
The only valid value is "all", ignore all other

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-01-27 17:56:43 +00:00
Zvonko Kaiser
e1596f7abf agent: Add option to parse cgroup_no_v1
For AGENT_INIT=yes we do not run systemd and hence
systemd.unified_... does not mean anything to other init
systems. Providing cgroup_no_v1=all is enough to signal
other init systemd to use cgroupV2.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-01-27 17:56:43 +00:00
Steve Horsman
54e7e1fdc3
Merge pull request #10768 from kata-containers/dependabot/go_modules/src/runtime/go_modules-28d0d344dd
build(deps): bump the go_modules group across 3 directories with 1 update
2025-01-24 12:04:56 +00:00
Greg Kurz
17f3eb0579
Merge pull request #10766 from balintTobik/remove_shebang
Remove shebang in non-executable completion script
2025-01-24 12:29:03 +01:00
Fabiano Fidêncio
c653719270 kernel: Ensure no cgroupsv1 is used
Let's ensure that we're fully running the guest on cgroupsv2.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-01-23 17:25:56 +01:00
Christophe de Dinechin
9a92a4bacf cli: Remove shebang in non-executable completion script
Raised during package review [1] by rpmlint

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1590425#c8

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Balint Tobik <btobik@redhat.com>
2025-01-23 13:11:25 +01:00
dependabot[bot]
d2cb14cdbc
build(deps): bump the go_modules group across 3 directories with 1 update
Bumps the go_modules group with 1 update in the /src/runtime directory: [golang.org/x/net](https://github.com/golang/net).
Bumps the go_modules group with 1 update in the /src/tools/csi-kata-directvolume directory: [golang.org/x/net](https://github.com/golang/net).
Bumps the go_modules group with 1 update in the /tools/testing/kata-webhook directory: [golang.org/x/net](https://github.com/golang/net).


Updates `golang.org/x/net` from 0.25.0 to 0.33.0
- [Commits](https://github.com/golang/net/compare/v0.25.0...v0.33.0)

Updates `golang.org/x/net` from 0.23.0 to 0.33.0
- [Commits](https://github.com/golang/net/compare/v0.25.0...v0.33.0)

Updates `golang.org/x/net` from 0.23.0 to 0.33.0
- [Commits](https://github.com/golang/net/compare/v0.25.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
  dependency-group: go_modules
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  dependency-group: go_modules
- dependency-name: golang.org/x/net
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-23 10:18:22 +00:00
Fupan Li
944eb2cf3f
Merge pull request #10762 from teawater/remove_enable_swap
libs/kata-types: Remove config enable_swap
2025-01-23 14:03:42 +08:00
Fupan Li
ebd8ec227b
Merge pull request #10778 from zvonkok/kata-agent-cgroupsV2
agent: Ensure proper cgroupsV2 handling with init_mode=true
2025-01-23 14:00:13 +08:00
Zvonko Kaiser
afd286f6d6 agent: Ensure proper cgroupsV2 with init_mode=yes
When the agent is run as the init process cgroupfs is being
setup. In the case of cgroupsV1 we needed to enable the memory hiearchy
this is now per default enabled in cgroupsV2. Additionally the file
/sys/fs/cgroup/memory/memory.use_hierarchy isn't even available with V2.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2025-01-23 03:54:51 +00:00
Fabiano Fidêncio
a8678a7794 deps: Update ttrpc to v0.8.4
Update the ttrpc crate to include the fix from Moritz Sanft, which
solves the connectivity issues with 6.12.x kernels*

*: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.9&id=3257813a3ae7462ac5cde04e120806f0c0776850

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2025-01-22 13:05:43 +01:00
Hui Zhu
c148b70da7 libs/kata-types: Remove config enable_swap
Remove config enable_swap because there is no code use it.

Fixes: #10761

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2025-01-22 11:08:45 +08:00
Hui Zhu
185b94b7fa runtime-rs: Add reclaim_guest_freed_memory cloud-hypervisor support
Add reclaim_guest_freed_memory config to cloud-hypervisor in runtime-rs.

Fixes: #10710

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2025-01-21 10:34:21 +08:00
Hui Zhu
487171d992 runtime-rs: Add reclaim_guest_freed_memory qemu support
Add reclaim_guest_freed_memory config to qemu in runtime-rs.

Fixes: #10710

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2025-01-21 10:34:18 +08:00
Hui Zhu
8f550de88a runtime-rs: db: Change config enable_balloon_f_reporting
Change config enable_balloon_f_reporting of db to
reclaim_guest_freed_memory.

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2025-01-21 10:34:08 +08:00
Dan Mihai
2e21f51375 runtime: skip empty Guest console output lines
Skip logging empty lines of text from the Guest console output, if
there are any such lines.

Without this change, the Guest console log from CLH + /dev/pts/0 has
twice as many lines of text. Half of these lines are empty.

Fixes: #10737

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2025-01-15 00:28:26 +00:00
Pradipta Banerjee
5218345e34 agent: alternative implementation for sealed_secret as volume
The earlier implementation relied on using a specific mount-path prefix - `/sealed`
to determine that the referenced secret is a sealed secret.
However that was restrictive for certain use cases as it forced
the user to always use a specific mountpath naming convention.

This commit introduces an alternative implementation to relax the
restriction. A sealed secret can be mounted in any mount-path.
However it comes with a potential performance penality. The
implementation loops through all volume mounts and reads the file
to determine if it's a sealed secret or not.

Fixes: #10398

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
2025-01-11 12:36:44 -05:00
Moritz Sanft
e5735b221c
runtime: use actual booleans for QMP device_add boolean options
Since
be93fd5372,
which is included in QEMU since version 9.2.0, the options for the
`device_add` QMP command need to be typed correctly.

This makes it so that instead of `"on"`, the value is set to `true`,
matching QEMU's expectations.

This has been tested on QEMU 9.2.0 and QEMU 9.1.2, so before and after
the change.

The compatibility with incorrectly typed options  for the `device_add`
command is deprecated since version 6.2.0 [^1].

[^1]:  https://qemu-project.gitlab.io/qemu/about/deprecated.html#incorrectly-typed-device-add-arguments-since-6-2

Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com>
2025-01-10 11:53:56 +01:00
Hui Zhu
d15a7baedd kata-ctl: direct-volume: Auto create KATA_DIRECT_VOLUME_ROOT_PATH
Got following issue:
kata-ctl direct-volume add /kubelet/kata-direct-vol-002/directvol002
"{\"device\": \"/home/t4/teawater/coco/t.img\", \"volume-type\":
\"directvol\", \"fstype\": \"\", \"metadata\":"{}", \"options\": []}"
subsystem: kata-ctl_main
 Dec 30 09:43:41.150 ERRO Os {
    code: 2,
    kind: NotFound,
    message: "No such file or directory",
}
The reason is KATA_DIRECT_VOLUME_ROOT_PATH is not exist.

This commit create_dir_all KATA_DIRECT_VOLUME_ROOT_PATH before join_path
to handle this issue.

Fixes: #10695

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-30 17:55:49 +08:00
Xuewei Niu
6400295940
Merge pull request #10683 from justxuewei/nxw/remove-mut 2024-12-29 00:49:38 +08:00
Fupan Li
2068801b80
Merge pull request #10626 from teawater/ma
Add mem-agent to kata
2024-12-24 14:11:36 +08:00
Xuewei Niu
ecf98e4db8 runtime-rs: Remove unneeded mut from new_hypervisor()
`set_hypervisor_config()` and `set_passfd_listener_port()` acquire inner
lock, so that `mut` for `hypervisor` is unneeded.

Fixes: #10682

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2024-12-20 17:08:10 +08:00
Liu Bo
95fc585103 kata-ctl: fix outdated comments
MgmnClient can also tolerate short sandbox id.

Signed-off-by: Liu Bo <liub.liubo@gmail.com>
2024-12-12 21:59:54 -08:00
Fupan Li
07fe7325c2
Merge pull request #10643 from justxuewei/fix-bind-vol
runtime-rs & agent: Fix the issues with bind volumes
2024-12-12 11:34:52 +08:00
Fupan Li
372346baed
Merge pull request #10641 from justxuewei/fix-build-type
runtime-rs: Ignore BUILD_TYPE if it is not release
2024-12-12 11:32:49 +08:00
Xuewei Niu
3fb91dd631 agent: Fix the issues with bind volumes
The mount type should be considered as empty if the value is
`Some("none")`.

Fixes: #10642

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2024-12-11 00:51:32 +08:00
Xuewei Niu
59ed19e8b2 runtime-rs: Fix the issues with bind volumes
This path fixes the logic of getting the type of volume: when the type of
OCI mount is Some("none") and the options have "bind" or "rbind", the
type will be considered as "bind".

Fixes: #10642

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2024-12-11 00:50:36 +08:00
Xuewei Niu
2424c1a562 runtime-rs: Ignore BUILD_TYPE if it is not release
This patch fixes that by adding `--release` only if `BUILD_TYPE=release`.

Fixes: #10640

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2024-12-11 00:27:28 +08:00
Xuewei Niu
b4695f6303 runtime-rs: Fix the issues with stderr fifo
When tty is enabled, stderr fifo should never be opened.

Fixes: #10637

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2024-12-10 21:48:52 +08:00
Aurélien Bombo
037281d699
Merge pull request #10593 from microsoft/saulparedes/improve_namespace_validation
policy: improve pod namespace validation
2024-12-09 11:55:09 -06:00
Steve Horsman
9b7fb31ce6
Merge pull request #10631 from stevenhorsman/action-lint-workflow
Action lint workflow
2024-12-09 09:33:07 +00:00
Sumedh Alok Sharma
ac4f986e3e runtime: Set memory config shared=false when shared_fs=None in CLH.
This commit sets memory config `shared` to false in cloud hypervisor
when creating vm with shared_fs=None && hugePages = false.

Currently in runtime/virtcontainers/clh.go,the memory config shared is by default set to true.
As per the CLH memory document,
(a) shared=true is needed in case like when using virtio_fs since virtiofs daemon runs as separate process than clh.
(b) for shared_fs=none + hugespages=false, shared=false can be set to use private anonymous memory for guest (with no file backing).
(c) Another memory config thp (use transparent huge pages) is always enabled by default.
As per documentation, (b) + (c) can be used in combination.
However, with the current CLH implementation, the above combination cannot be used since shared=true is always set.

Fixes #10547

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2024-12-06 21:22:51 +05:30
stevenhorsman
f02d540799 workflows: Bump outdated action versions
Bump some actions that are significantly out-of-date
and out of sync with the versions used in other workflows

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2024-12-06 13:50:12 +00:00
Hui Zhu
d3a6bcdaa5 runtime-rs: configuration-dragonball.toml.in: Add config for mem-agent
Add config for mem-agent to configuration-dragonball.toml.in.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:28 +08:00
Hui Zhu
2b6caf26e0 agent-ctl: Add mem-agent API support
Add sub command MemAgentMemcgSet and MemAgentCompactSet to agent-ctl to
configate the mem-agent inside the running kata-containers.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:24 +08:00
Hui Zhu
cb86d700a6 config: Add config of mem-agent
Add config of mem-agent to configate the mem-agent.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:20 +08:00
Hui Zhu
692ded8f96 agent: add support for MemAgentMemcgSet and MemAgentCompactSet
Add MemAgentMemcgSet and MemAgentCompactSet to agent API to set the config of
mem-agent memcg and compact.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:16 +08:00
Hui Zhu
f84ad54d97 agent: Start mem-agent in start_sandbox
mem-agent will run with kata-agent.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:13 +08:00
Hui Zhu
74a17f96f4 protocols/protos/agent.proto: Add mem-agent support
Add MemAgentMemcgConfig and MemAgentCompactConfig to AgentService.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:09 +08:00
Hui Zhu
ffc8390a60 agent: Add mem-agent to Cargo.toml
Add mem-agent to Cargo.toml of agent.
mem-agent will be integrated into kata-agent.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:05 +08:00
Hui Zhu
4407f6e098 mem-agent: Add to src
mem-agent is a component designed for managing memory in Linux
environments.
Sub-feature memcg: Utilizes the MgLRU feature to monitor each cgroup's
memory usage and periodically reclaim cold memory.
Sub-feature compact: Periodically compacts memory to facilitate the
kernel's free page reporting feature, enabling the release of more idle
memory from guests.
During memory reclamation and compaction, mem-agent monitors system
pressure using Pressure Stall Information (PSI). If the system pressure
becomes too high, memory reclamation or compaction will automatically
stop.

Fixes: #10625

Signed-off-by: Hui Zhu <teawater@antgroup.com>
2024-12-06 10:00:02 +08:00
Saul Paredes
84a411dac4 policy: improve pod namespace validation
- Remove default_namespace from settings
- Ensure container namespaces in a pod match each other in case no namespace is specified in the YAML

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2024-12-04 10:17:54 -08:00
Fabiano Fidêncio
531a29137e
Merge pull request #10607 from microsoft/danmihai1/less-logging
runtime: skip logging some of the dial errors
2024-12-04 15:01:45 +01:00
Alex Lyn
5f9cc86b5a
Merge pull request #10604 from 3u13r/euler/fix/genpolicy-rego-state-getter
genpolicy: align state path getter and setter
2024-12-04 13:57:34 +08:00
Alex Lyn
c7064027f4
Merge pull request #10574 from BbolroC/add-ccw-subchannel-qemu-runtime-rs
Add subchannel support to qemu-runtime-rs for s390x
2024-12-04 09:17:45 +08:00
Aurélien Bombo
fe55b29ef0 csi-kata-directvolume: Remove go version check
The driver build recipe has a script to check the current Go version against
the go.mod version.  However, the script is broken ($expected is unbound) and I
don't believe we do this for other components. On top of this, Go should be
backward-compatible. Let's keep things simple for now and we can evaluate
restoring this script in the future if need be.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2024-12-03 14:43:36 -06:00
Aurélien Bombo
fb87bf221f ci: Implement build step for CSI driver
This fully implements the compilation step for csi-kata-directvolume.
This component can now be built by the CI running:

 $ cd tools/packaging/kata-deploy/local-build
 $ make csi-kata-directvolume-tarball

A couple notes:

 * When installing the binary, we rename it from directvolplugin to
   csi-kata-directvolume on the fly to make it more readable.
 * We add go to the tools builder Dockerfile to support building this
   tool.
 * I've noticed the file install_libseccomp.sh gets created by the build
   process so I've added it to a .gitignore.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2024-12-03 14:43:36 -06:00
Dan Mihai
2a67038836
Merge pull request #10608 from microsoft/saulparedes/policy_metadatata_uid
policy: ignore optional metadata uid field
2024-12-03 10:19:12 -08:00
Hyounggyu Choi
8b998e5f0c runtime-rs: Introduce get_devno_ccw() for deduplication
The devno assignment logic is repeated in 5 different places
during device addition.
To improve code maintainability and readability, this commit
introduces a standalone function, `get_devno_ccw()`,
to handle the deduplication.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-12-03 15:35:03 +01:00
Leonard Cohnen
9b614a4615 genpolicy: align state path getter and setter
Before this patch there was a mismatch between the JSON path under which
the state of the rule evaluation is set in comparison to under which
it is retrieved.

This resulted in the behavior that each time the policy was evaluated,
it thought it was the _first_ time the policy was evaluated.
This also means that the consistency check for the `sandbox_name`
was ineffective.

Signed-off-by: Leonard Cohnen <lc@edgeless.systems>
2024-12-03 13:25:24 +01:00
Saul Paredes
711d12e5db policy: support optional metadata uid field
This prevents a deserialization error when uid is specified

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2024-12-02 11:24:58 -08:00
Dan Mihai
efd492d562 runtime: skip logging some of the dial errors
With full debug logging enabled there might be around 1,500 redials
so log just ~15 of these redials to avoid flooding the log.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-12-02 19:11:32 +00:00
Saul Paredes
9105c1fa0c policy: add constants to rules.rego
Reuse constants where applicable

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2024-12-02 08:28:58 -08:00
Aurélien Bombo
eac197d3b7
Merge pull request #10564 from microsoft/danmihai1/clh-endpoint-type
runtime: clh: addNet() logging clean-up
2024-11-27 14:44:14 -06:00
Steve Horsman
6bb00d9a1d
Merge pull request #10583 from squarti/agent-startup-cdh-client
agent: fix startup when guest_components_procs is set to none
2024-11-27 11:43:07 +00:00
Silenio Quarti
1230bc77f2 agent: fix startup when guest_components_procs is set to none
This PR ensures that OCICRYPT_CONFIG_PATH file is initialized only
when CDH socket exists. This prevents startup error if attestation
binaries are not installed in PodVM.

Fixes: https://github.com/kata-containers/kata-containers/issues/10568

Signed-off-by: Silenio Quarti <silenio_quarti@ca.ibm.com>
2024-11-26 09:57:04 -05:00
Fupan Li
28166c8a32
Merge pull request #10577 from Apokleos/fix-vfiodev-name
runtime-rs: fix vfio device name combination issue
2024-11-26 09:35:45 +08:00
Dan Mihai
d93900c128
Merge pull request #10543 from microsoft/danmihai1/regorus-warning
genpolicy: avoid regorus warning
2024-11-25 16:47:33 -08:00
Dan Mihai
f340b31c41 genpolicy: avoid regorus warning
Avoid adding to the Guest console warnings about "agent_policy:10:8".

"import input" is unnecessary.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-11-25 21:19:01 +00:00
Dan Mihai
78cbf33f1d runtime: clh: addNet() logging clean-up
Avoid logging the same endpoint fields twice from addNet().

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-11-25 19:58:54 +00:00
alex.lyn
5dba680afb runtime-rs: fix vfio device name combination issue
Fixes #10576

Signed-off-by: alex.lyn <alex.lyn@antgroup.com>
2024-11-25 14:01:43 +08:00
Hyounggyu Choi
48e2df53f7 runtime-rs: Add devno to DeviceVirtioScsi
A new attribute named `devno` is added to DeviceVirtioScsi.
It will be used to specify a device number for a CCW bus type.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-11-23 13:45:36 +01:00
Hyounggyu Choi
2cc48f7822 runtime-rs: Add devno to DeviceVhostUserFs
A new attribute named `devno` is added to DeviceVhostUserFs.
It will be used to specify a device number for a CCW bus type.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-11-23 13:45:36 +01:00
Hyounggyu Choi
920484918c runtime-rs: Add devno to VhostVsock
A new attribute named `devno` is added to VhostVsock.
It will be used to specify a device number for a CCW bus type.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-11-23 13:45:36 +01:00
Hyounggyu Choi
9486790089 runtime-rs: Add devno to DeviceVirtioSerial
A new attribute named `devno` is added to DeviceVirtioSerial.
It will be used to specify a device number for a CCW bus type.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-11-23 13:45:36 +01:00
Hyounggyu Choi
516daecc50 runtime-rs: Add devno to DeviceVirtioBlk
A new attribute named `devno` is added to DeviceVirtioBlk.
It will be used to specify a device number for a CCW bus type.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-11-23 13:45:36 +01:00
Hyounggyu Choi
30a64092a7 runtime-rs: Add CcwSubChannel to provide devno for CCW devices
To explicitly specify a device number on the QEMU command line
for the following devices using the CCW transport on s390x:

- SerialDevice
- BlockDevice
- VhostUserDevice
- SCSIController
- VSOCKDevice

this commit introduces a new structure CcwSubChannel and implements
the following methods:

- add_device()
- remove_device()
- address_format_ccw()
- set_addr()

You can see the detailed explanation for each method in the comment.

This resolves the 1st part of #10573.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-11-23 13:45:36 +01:00
Zvonko Kaiser
e9f36f8187 ci: Fixing simple typo
change evn to env

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2024-11-20 18:40:14 +00:00
Zvonko Kaiser
a5733877a4 ci: Fix error on self-hosted machines
We need to clean-up any created files/dirs otherwise
we cause problems on self-hosted runners. Using tempdir which
will be removed automatically.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2024-11-20 18:40:13 +00:00
Saul Paredes
eab48c9884
Merge pull request #10545 from microsoft/cameronbaird/sync-clh-logging
runtime: fix comment to accurately reflect clh behavior
2024-11-18 11:25:58 -08:00
Steve Horsman
0ce3f5fc6f
Merge pull request #10514 from squarti/pause_command
agent: overwrite OCI process spec when overwriting pause image
2024-11-15 18:03:58 +00:00
Cameron Baird
65881ceb8a runtime: fix comment to accurately reflect clh behavior
Fix the CLH log levels description

Signed-off-by: Cameron Baird <cameronbaird@microsoft.com>
2024-11-14 23:16:11 +00:00
Silenio Quarti
42b6203493 agent: overwrite OCI process spec when overwriting pause image
The PR replaces the OCI process spec of the pause container with the spec of
the guest provided pause bundle.

Fixes: https://github.com/kata-containers/kata-containers/issues/10537

Signed-off-by: Silenio Quarti <silenio_quarti@ca.ibm.com>
2024-11-14 13:05:16 -05:00
Hyounggyu Choi
5869046d04
Merge pull request #9195 from UiPath/fix/vcpus-for-static-mgmt
runtime: Set maxvcpus equal to vcpus for the static resources case
2024-11-14 09:38:20 +01:00
Dan Mihai
d9977b3e75
Merge pull request #10431 from microsoft/saulparedes/add-policy-state
genpolicy: add state to policy
2024-11-13 11:48:46 -08:00
Fabiano Fidêncio
02d4c3efbf
Merge pull request #10519 from fidencio/topic/relax-restriction-for-qemu-tdx
Reapply "runtime: confidential: Do not set the max_vcpu to cpu"
2024-11-13 16:09:06 +01:00
Saul Paredes
c207312260 genpolicy: validate container sandbox names
Make sure all container sandbox names match the sandbox name of the first container.

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2024-11-12 15:17:01 -08:00
Saul Paredes
52d1aea1f7 genpolicy: Add state
Use regorous engine's add_data method to add state to the policy.
This data can later be accessed inside rego context through the data namespace.

Support state modifications (json-patches) that may be returned as a result from policy evaluation.

Also initialize a policy engine data slice "pstate" dedicated for storing state.

Fixes #10087

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2024-11-12 15:16:53 -08:00
Alexandru Matei
e83f8f8a04 runtime: Set maxvcpus equal to vcpus for the static resources case
Fixes: #9194

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
2024-11-12 16:36:42 +02:00
Fabiano Fidêncio
56812c852f
Reapply "runtime: confidential: Do not set the max_vcpu to cpu"
This reverts commit f15e16b692, as 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.org>
2024-11-09 23:20:17 +01:00
Aurélien Bombo
19e972151f gha: Hardcode ubuntu-22.04 instead of latest
GHA is migrating ubuntu-latest to Ubuntu 24 so
let's hardcode the current 22.04 LTS.

https://github.blog/changelog/2024-11-05-notice-of-breaking-changes-for-github-actions/

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2024-11-08 11:00:15 -06:00
Zvonko Kaiser
183bd2aeed
Merge pull request #9584 from zvonkok/kata-agent-cdi
kata-agent: Add CDI support
2024-11-07 14:18:32 -05:00
Zvonko Kaiser
aa2e1a57bd agent: Added test-case for handle_cdi_devices
We are generating a simple CDI spec with device and
global containerEdits to test the CDI crate.

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2024-11-07 17:03:18 +00:00
Fabiano Fidêncio
c332e953f9
Merge pull request #10500 from squarti/fix-10499
runtime: Files are not synced between host and guest VMs
2024-11-07 08:28:53 +01:00
Silenio Quarti
be3ea2675c runtime: Files are not synced between host and guest VMs
This PR makes the root dir absolute after resolving the
default root dir symlink. 

Fixes: https://github.com/kata-containers/kata-containers/issues/10499

Signed-off-by: Silenio Quarti <silenio_quarti@ca.ibm.com>
2024-11-06 17:31:12 -05:00
Zvonko Kaiser
3995fe71f9 kata-agent: Add CDI support
For proper device handling add CDI support

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2024-11-06 17:50:20 +00:00
Fabiano Fidêncio
7d3f2f7200 runtime: Match TEEs for the static_sandbox_resource_mgmt option
The qemu-coco-dev runtime class should be as close as possible to what
the TEEs runtime classes are doing, and this was one of the options that
ended up overlooked till now.

Shout out to Dan Mihai for noticing that!

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-11-06 10:47:08 +01:00
Fabiano Fidêncio
ea8114833c
Merge pull request #10491 from fidencio/topic/fix-typo-in-the-ephemeral-handler
agent: fix typo on getting EphemeralHandler size option
2024-11-06 10:31:48 +01:00
Fabiano Fidêncio
77c87a0990 agent: fix typo on getting EphemeralHandler size option
Most likely this was overlooked during the development / review, but
we're actually interested on the size rather than on the pagesize of the
hugepages.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-11-05 15:15:17 +01:00
Aurélien Bombo
f639d3e87c
Merge pull request #10395 from Sumynwa/sumsharma/create_container
agent-ctl: Add support to test kata-agent's container creation APIs.
2024-11-04 14:09:12 -06:00
Steve Horsman
a2b9527be3
Merge pull request #10481 from mkulke/mkulke/init-cdh-client-on-gcprocs-none
agent: perform attestation init w/o process launch
2024-11-04 17:27:45 +00:00
Magnus Kulke
bf769851f8 agent: perform attestation init w/o process launch
This change is motivated by a problem in peerpod's podvms. In this setup
the lifecycle of guest components is managed by systemd. The current code
skips over init steps like setting the ocicrypt-rs env and initialization
of a CDH client in this case.

To address this the launch of the processes has been isolated into its
own fn.

Signed-off-by: Magnus Kulke <magnuskulke@microsoft.com>
2024-11-04 13:31:07 +01:00
Steve Horsman
06d2cc7239
Merge pull request #10453 from bpradipt/remote-annotation
runtime: Add GPU annotations for remote hypervisor
2024-11-04 09:10:06 +00:00
Sumedh Alok Sharma
4b7aba5c57 agent-ctl: Add support to test kata-agent's container creation APIs.
This commit introduces changes to enable testing kata-agent's container
APIs of CreateContainer/StartContainer/RemoveContainer. The changeset
include:
- using confidential-containers image-rs crate to pull/unpack/mount a
container image. Currently supports only un-authenicated registry pull
- re-factor api handlers to reduce cmdline complexity and handle
request generation logic in tool
- introduce an OCI config template for container creation
- add test case

Fixes #9707

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2024-11-01 22:18:54 +05:30
Markus Rudy
df5e6e65b5 protocols: only build RLimit impls on Linux
The current version of the oci-spec crate compiles RLimit structs only
for Linux and Solaris. Until this is fixed upstream, add compilation
conditions to the type converters for the affected structs.

Fixes: #10071

Signed-off-by: Markus Rudy <mr@edgeless.systems>
2024-10-31 09:50:36 +01:00
Markus Rudy
091a410b96 kata-sys-util: move json parsing to protocols crate
The parse_json_string function is specific to parsing capability strings
out of ttRPC proto definitions and does not benefit from being available
to other crates. Moving it into the protocols crate allows removing
kata-sys-util as a dependency, which in turn enables compiling the
library on darwin.

Fixes: #10071

Signed-off-by: Markus Rudy <mr@edgeless.systems>
2024-10-31 09:41:07 +01:00
Markus Rudy
8ab4bd2bfc kata-sys-util: remove obsolete cgroups dependency
The cgroups.rs source file was removed in
234d7bca04. With cgroups support handled
in runtime-rs, the cgroups dependency on kata-sys-util can be removed.

Signed-off-by: Markus Rudy <mr@edgeless.systems>
2024-10-31 09:41:07 +01:00
Chasing1020
425f6ad4e6 runtime-rs: add oci spec for prepare_vm method
The cloud-api-adaptor needs to support different types of pod VM
instance.
We needs to pass some annotations like machine_type, default_vcpus and
default_memory to prepare the VMs.

Signed-off-by: Chasing1020 <643601464@qq.com>
2024-10-30 01:01:28 +08:00
Chasing1020
f1167645f3 runtime-rs: support for remote hypervisors type
This patch adds the support of the remote hypervisor type for runtime-rs.
The cloud-api-adaptor needs the annotations and network namespace path
to create the VMs.
The remote hypervisor opens a UNIX domain socket specified in the config
file, and sends ttrpc requests to a external process to control sandbox
VMs.

Fixes: #10350

Signed-off-by: Chasing1020 <643601464@qq.com>
2024-10-30 00:54:17 +08:00