Commit Graph

13462 Commits

Author SHA1 Message Date
Pavel Mores
d1e6f9cc4e runtime-rs: add IOMMU to qemu VM if configured
The adding itself is done by a new function add_iommu() that conforms with
the add_*() convention.  Note though that this function is called
internally, by the QemuCmdLine constructor, simply because there's nothing
to trigger its invocation from QemuInner (unlike the other add_*()
functions so far).

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-04-26 14:48:00 +02:00
Pavel Mores
0859f47a17 runtime-rs: add representation of '-device intel-iommu' to qemu-rs
Following the golang shim example, the values are hardcoded.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-04-26 14:47:51 +02:00
Pavel Mores
702bf0d35e runtime-rs: support qemu machine's 'kernel_irqchip' param
We will want to set kernel_irqchip when enabling IOMMU and this commit
adds the requisite support.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-04-26 14:42:54 +02:00
Alex Lyn
f72c6ba814
Merge pull request #9519 from emanuellima1/impl-rtc
runtime-rs: Add RTC to QEMU cmdline
2024-04-26 17:44:47 +08:00
Dan Mihai
b42ddaf15f
Merge pull request #9530 from microsoft/saulparedes/improve_caching
genpolicy: changing caching so the tool can run concurrently with itself
2024-04-25 13:06:23 -07:00
David Esparza
ae317a319f
Merge pull request #9549 from JakubLedworowski/fix-tarball-dockerfile
build: Fix tarball not building correctly in docker
2024-04-25 09:40:20 -06:00
James O. D. Hunt
5bd614530f
Merge pull request #9525 from jodh-intel/gha-k8s-ch-dm
gha: Enable k8s tests for cloud hypervisor with devicemapper
2024-04-25 09:28:09 +01:00
Fabiano Fidêncio
b4360e7e37
Merge pull request #9510 from microsoft/danmihai1/regorus-policy2
agent: use regorus instead of opa
2024-04-24 21:40:29 +02:00
James O. D. Hunt
ff7349b6f0 gha: Enable k8s tests for cloud hypervisor with devicemapper
Enable the k8s tests for cloud hypervisor with devicemapper.

Fixes: #9221.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Co-authored-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-04-24 16:32:51 +01:00
Dan Mihai
2400a4d249
Merge pull request #9428 from arc9693/archana1/genplicyfixes
genpolicy: implement default methods for K8sResource trait
2024-04-24 08:04:19 -07:00
Dan Mihai
ff385eac41 agent: remove unnecessary comment
Remove reminder to initialize Policy earlier, because currently there
are no plans to initialize earlier.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-24 14:53:51 +00:00
Jakub Ledworowski
73366da9f9 build: Fix tarball not building correctly in docker
When docker is installed on the host system using script from https://get.docker.com/ it automatically creates a docker group with gid=999.
Then during docker build process of tarball, eg. make qemu-tdx-experimental-tarball docker is also installed inside the image with the same
script, which also automatically adds docker group with gid=999.
Then, the build tries to add a new group docker_on_host with gid=999, which already exists, which breaks the build.

Signed-off-by: Jakub Ledworowski <jakub.ledworowski@intel.com>
2024-04-24 15:35:36 +02:00
Fabiano Fidêncio
4e35f11a3d
Merge pull request #9535 from fidencio/topic/fix-crio-debug-drop-in
kata-deploy: Stop append `log_level = "debug"` for CRI-O
2024-04-24 10:03:36 +02:00
Dan Mihai
89c85dfe84
Merge pull request #9432 from UiPath/fix-clh-wait
clh: isClhRunning waits for full timeout when clh exits
2024-04-23 13:02:45 -07:00
Hyounggyu Choi
608df9b7df
Merge pull request #9494 from BbolroC/guest-pull-gha-s390x
CC: Enable guest-pull tests on non-TEE for s390x
2024-04-23 21:22:37 +02:00
Dan Mihai
e5c3f5fa9b tests: no generated policy for untested platforms
Avoid auto-generating Policy on platforms that haven't been tested
yet with auto-generated Policy.

Support for auto-generated Policy on these additional platforms is
coming up in future PRs, so the tests being fixed here were
prematurely enabled.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-23 16:07:03 +00:00
Emanuel Lima
2bc5e3c6e2 runtime-rs: Add RTC to QEMU cmdline
Add RTC by hardcoding the ooptions base=utc,driftfix=slew,clock=host

Signed-off-by: Emanuel Lima <emlima@redhat.com>
2024-04-23 10:46:30 -03:00
Fabiano Fidêncio
d190c9d4d9
kata-deploy: Stop append log_level = "debug" for CRI-O
This should only be done once, and if CRI-O restarts, there's a big
chance kata-deploy will also restart and the user would end up with a
file that looks like:
```
[crio]
log_level = "debug"
[crio]
log_level = "debug"
[crio]
log_level = "debug"
...
```

And that would simply cause CRI-O to not start.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-04-23 14:51:35 +02:00
Greg Kurz
42a79801f3
Merge pull request #9524 from littlejawa/fix_createruntime_hook_not_called
runtime: Call CreateRuntime hooks at container creation time
2024-04-23 13:43:36 +02:00
Fupan Li
469c4e4f44
Merge pull request #9335 from Tim-Zhang/fix-passfd-fifo-open
passfd-io: fix FIFO opening and vsock handling
2024-04-23 09:04:45 +08:00
Alex Lyn
bc2cf95e7a
Merge pull request #9517 from amshinde/update-storage-source-pciblock
runtime-rs: Update storage source for pci block devices
2024-04-23 07:32:36 +08:00
Dan Mihai
5d31eb4847 agent: use regorus 0.1.4
Use regorus 0.1.4 from crates.io, instead of its source code
repository.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-22 23:21:17 +00:00
Dan Mihai
ed6412b63c tests: k8s: reduce the policy tests output noise
Hide some of the kubectl output, to reduce the size and redundancy of
this output.

Fixes: #9388

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-22 19:59:33 +00:00
Dan Mihai
df23eb09a6 agent: use regorus instead of opa
Implement Agent Policy using the regorus crate instead of the OPA
daemon.

The OPA daemon will be removed from the Guest rootfs in a future PR.

Fixes: #9388

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-22 19:58:30 +00:00
Dan Mihai
58e608d61a tests: remove k8s-policy-set-keys.bats
Remove k8s-policy-set-keys.bats in preparation for using the regorus
crate instead of the OPA daemon for evaluating the Agent Policy. This
test depended on sending HTTP requests to OPA.

Fixes: #9388

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-22 19:49:38 +00:00
Dan Mihai
b509c1beee agent: lock anyhow version to 1.0.58
Lock anyhow version to 1.0.58 because:

- Versions between 1.0.59 - 1.0.76 have not been tested yet using
  Kata CI. However, those versions pass "make test" for the
  Kata Agent.

- Versions 1.0.77 or newer fail during "make test" - see
  https://github.com/kata-containers/kata-containers/issues/9538.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-04-22 19:49:15 +00:00
Archana Shinde
cc6b671101 runtime-rs: Update storage source for pci block devices
In case of block devices using virtio-block, we need to pass the
pci-path as the storage source field to the agent.
Current the virt-path is being passed which works just for mmio block
devices.
In the future when support is added for scsi, block-ccw and pmem
devices, the storage source would need to be handled accordingly.

Fixes: #9034

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-04-22 11:36:58 -07:00
Hyounggyu Choi
f10744df99 CC: Enable guest-pull tests on non-TEE for s390x
This commit is to add a new CI job to run-k8s-tests-on-zvsi.yaml.
Why the job is not configured in run-kata-coco-tests.yaml by having it
integrated with `run-k8s-tests-coco-nontee` is:

- It uses k3s instead of AKS
- It runs on a self-hosted runner

These differences make the integrated job not easy to read and maintain
when it comes to incorporating other platforms in the near future.

Fixes: #9467

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-04-22 17:15:20 +02:00
Greg Kurz
6ca0f09710
Merge pull request #9518 from microsoft/danmihai1/agent-cargo-lock
agent: update cargo.lock
2024-04-22 13:36:06 +02:00
Tim Zhang
aeba483ec8 agent: avoid fd leakage of passfd-io
In do_create_container and do_exec_process, we should create the proc_io first,
in case there's some error occur below, thus we can make sure
the io stream closed when error occur.

Signed-off-by: Tim Zhang <tim@hyper.sh>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2024-04-22 17:39:33 +08:00
Tim Zhang
8441187d5e runtime-rs: fix FIFO handling
Fixes: #9334

In linux, when a FIFO is opened and there are no writers, the reader
will continuously receive the HUP event. This can be problematic.
To avoid this problem, we open stdin in write mode and keep the stdin-writer

We need to open the stdout/stderr as the read mode and keep the open endpoint
until the process is delete. otherwise,
the process would exit before the containerd side open and read
the stdout fifo, thus runD would write all of the stdout contents into
the stdout fifo and then closed the write endpoint. Then, containerd
open the stdout fifo and try to read, since the write side had closed,
thus containerd would block on the read forever.
Here we keep the stdout/stderr read endpoint File in the common_process,
which would be destroied when containerd send the delete rpc call,
at this time the containerd had waited the stdout read return, thus it
can make sure the contents in the stdout/stderr fifo wouldn't be lost.

Signed-off-by: Tim Zhang <tim@hyper.sh>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2024-04-22 17:39:33 +08:00
Tim Zhang
d68eb7f0ad agent: Fix close_stdin for passfd-io
In scenario passfd-io, we should wait for stdin to close itself
instead of manually intervening in it.

Signed-off-by: Tim Zhang <tim@hyper.sh>
Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2024-04-22 17:39:32 +08:00
Steve Horsman
ff9985fc50
Merge pull request #9490 from wainersm/port_attestation_nontee_job
gha: move attestation tests to run-k8s-tests-coco-nontee
2024-04-22 10:23:11 +01:00
Archana Choudhary
4a010cf71b genpolicy: add default implementations for K8sResource trait
This commit adds default implementations for following methods of
K8sResource trait:
- generate_policy
- serialize

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:59:02 +00:00
Archana Choudhary
6edc3b6b0a genpolicy: add default implementation for use_sandbox_pidns
This patch adds a default implementation for the use_sandbox_pidns
and updates the structs that implement the K8sResource trait to use
the default.

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:59:02 +00:00
Archana Choudhary
d5d3f9cda7 genpolicy: add default implementation for use_host_network
- Provide default implementation for use_host_network
- Remove default implementation from structs implementing the trait K8sResource

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:59:02 +00:00
Archana Choudhary
9a3eac5306 genpolicy: add default impl for get_containers
- Provide default impl for get_containers
- Remove default impl from structs implementing the trait K8sResource

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:59:02 +00:00
Archana Choudhary
2db3470602 genpolicy: add default impl for get_container_mounts_and_storages
- Provide default impl for get_container_mounts_and_storages
- Remove default impl from structs implementing the trait K8sResource

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:59:02 +00:00
Archana Choudhary
09b0b4c11d genpolicy: add default implementation for get_sandbox_name
- Provide default implementation for get_sandbox_name in K8sResource trait
- Remove default implementation from structs implementing the trait K8sResource

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:55:32 +00:00
Archana Choudhary
43e9de8125 genpolicy: add default implementation for get_annotations
- Provide default implementation for get_annontations.
- Remove default implementation from structs implementing the trait K8sResource

Fixes: #8960
Signed-off-by: Archana Choudhary <archana1@microsoft.com>
2024-04-21 12:55:32 +00:00
Saul Paredes
2149cb6502 genpolicy: changing caching so the tool can run
concurrently with itself

Based on 3a1461b0a5186a92afedaaea33ff2bd120d1cea0

Previously the tool would use the layers_cache folder for all instances
and hence delete the cache when it was done, interfereing with other
instances. This change makes it so that each instance of the tool will
have its own temp folder to use.

Signed-off-by: Saul Paredes <saulparedes@microsoft.com>
2024-04-19 15:46:30 -07:00
Wainer dos Santos Moschetta
1e35291fd5 gha: move attestation tests to run-k8s-tests-coco-nontee
The new run-k8s-tests-coco-nontee job should be the home of attestation
tests.

Changed run-k8s-tests-coco-nontee to get KBS installed and by the time the
KBS variable is exported in the environment then the attestation tests
will kick in (likewise they will skip in run-k8s-tests-on-aks).

Fixes #9455
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-04-19 14:51:30 -03:00
Steve Horsman
7e12d588c0
Merge pull request #9485 from sparky005/update_golang.org/x/net
update golang.org/x/net
2024-04-19 11:26:13 +01:00
Amulya Meka
12964256a4
Merge pull request #9521 from Amulyam24/gha
gha: tag k8s tests on ppc64le to ppc64le-runner-01
2024-04-19 15:08:08 +05:30
Julien Ropé
70e798ed35 runtime: Call CreateRuntime hooks at container creation time
CreateRuntime hooks are called at the CreateSandbox time,
but not after CreateContainer.

Fixes: #9523

Signed-off-by: Julien Ropé <jrope@redhat.com>
2024-04-19 10:25:02 +02:00
Alex Lyn
3456483df9
Merge pull request #9513 from stevenhorsman/bump-stale-version
gha: stale: Bump stalebot version
2024-04-19 15:15:10 +08:00
Alex Lyn
c147f0f4ed
Merge pull request #9516 from sprt/rlz-340
release: bump version for 3.4.0 release
2024-04-19 15:12:26 +08:00
Amulyam24
8255ed248a gha: tag k8s tests on ppc64le to ppc64le-runner-01
This PR aims at running the k8s tests to one runner on ppc64le.

Fixes: #9520

Signed-off-by: Amulyam24 <amulmek1@in.ibm.com>
2024-04-19 12:04:25 +05:30
Hyounggyu Choi
304dc1e4da doc: Update how-to-run-kata-containers-with-SE-VMs.md
This is to update a document `how-to-run-kata-containers-with-SE-VMs`
on using confidential artifacts to build a secure image.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-04-19 08:31:12 +02:00
Hyounggyu Choi
8fbed9f6a4 local-build: Use confidential kernel and initrd for boot-image-se
This is to make `boot-image-se-tarball` use confidential kernel and
initrd instead of vanilla version of artifacts.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-04-19 07:09:04 +02:00