Commit Graph

12991 Commits

Author SHA1 Message Date
Fabiano Fidêncio
344e0580ca
tests: cri-o: Use packages from pkgs.k8s.io
CRI-O has moved, for a long time, towards pkgs.k8s.io, see:
https://kubernetes.io/blog/2023/10/10/cri-o-community-package-infrastructure/

With this the OBS repo won't be used anymore.

Fixes: #8935

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-09 12:15:55 +01:00
Fabiano Fidêncio
03f7cfd429
Merge pull request #9061 from GabyCT/topic/csk
tests:k8s: make add_kernel_initrd_anotations function generic
2024-02-09 10:05:58 +01:00
Fabiano Fidêncio
555784268d
Merge pull request #9031 from ChengyuZhu6/guest-pull-rootfs
packaging/osbuilder: allow to pull and unpack pause image
2024-02-08 22:21:44 +01:00
Gabriela Cervantes
0b508f301b tests:k8s: make add_kernel_initrd_anotations function generic
This PR replaces the add_kernel_initrd_annotations_to_yaml function
more generic so later can be used for other components.

Fixes #9054

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-02-08 19:30:43 +00:00
Dan Mihai
f139c7dc60 tests: k8s: k8s-copy-file auto-generated policy
Auto-generate policy for k8s-copy-file.bats.

Fixes: #9050

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-08 13:26:05 +00:00
Dan Mihai
1179306afa tests: k8s: additional policy testing utilities
1. add_requests_to_policy_settings allows one or more ttrpc requests
   from the Host to the Guest. Example:

add_requests_to_policy_settings "${policy_settings_dir}" \
   "ReadStreamRequest" "WriteStreamRequest"

2. add_copy_from_host_to_policy_settings allows executing on the Guest
   the commands initiated behind the scenes by "kubectl cp" from the
   Host to the Guest. Example:

add_copy_from_host_to_policy_settings "${policy_settings_dir}"

3. add_copy_from_guest_to_policy_settings allows executing on the Guest
   the commands initiated behind the scenes by "kubectl cp" from the
   Guest to the Host. Example:

add_copy_from_guest_to_policy_settings "${policy_settings_dir}" \
   "/tmp/file.txt"

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-08 13:25:41 +00:00
Steve Horsman
b99f574522
Merge pull request #9037 from niteeshkd/nd_SevSnpGuest
runtime: fix creation of SEV confidential container on SNP enabled host.
2024-02-08 09:29:20 +00:00
ChengyuZhu6
a43edd0c30 rootfs: Install pause image into rootfs
Install the pause image into the confidential rootfs
image and initrd.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2024-02-08 16:49:56 +08:00
Greg Kurz
6ead48ec06
Merge pull request #8986 from pmores/drop-shim-v2-address-value-validation
runtime-rs: fix interoperability issues between runtime-rs and cri-o
2024-02-08 09:44:12 +01:00
ChengyuZhu6
42ef6bdcae osbuilder:rootfs: support to unpack pause image to rootfs
This env ver will serve us to pass the pause image tarball to the rootfs builder, which will then just
unpack the content into the rootfs.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Co-authored-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
Co-authored-by: Wang, Arron <arron.wang@intel.com>
Co-authored-by: stevenhorsman <steven@uk.ibm.com>
Co-authored-by: Jakob Naucke <jakob.naucke@ibm.com>
2024-02-08 16:29:36 +08:00
ChengyuZhu6
53183cba31 workflow: Enable to build pause image in ci
Enable to build pause image static tarball for confidential containers
casesi in ci environment.

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2024-02-08 11:23:23 +08:00
ChengyuZhu6
70a84eca9e packaging: allow to pull and unpack pause image
For Confidential containers stack, the pause image is managed by host side,
then it may configure a malicious pause image, we need package
a pause image inside the rootfs and don't the pause image from host.

But the installation of skopeo is not included in 20.04 release, so we
can not directly install skopeo in rootfs and pull pause image.

So I plan to let the task as a static build stuff, which would not be influenced
by the system version in rootfs. And the pause image will be part of the Kata Containers rootfs
that's used by the Confidential Containers usecase. This commit enables the component to be built
both locally and in our CI environment with the command: make pause-image-tarball.

Fixes: #9032

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
Co-authored-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
Co-authored-by: Wang, Arron <arron.wang@intel.com>
Co-authored-by: stevenhorsman <steven@uk.ibm.com>
Co-authored-by: Jakob Naucke <jakob.naucke@ibm.com>
2024-02-08 11:23:23 +08:00
Dan Mihai
9a780aa98f genpolicy: improve logging from ExecProcessRequest
Additional logging from the ExecProcessRequest rules, for easier
debugging.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-08 02:21:58 +00:00
Dan Mihai
dab567bdfa genpolicy: add easy way to allow CloseStdinRequest
For example, Kata CI's k8s-copy-file.bats transfers files between the
Host and the Guest using "kubectl exec", and that results in
CloseStdinRequest being called from the Host.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-08 02:21:58 +00:00
Dan Mihai
8401adb113 genpolicy: update default values
1. Remove PullImageRequest because that is not used in the main
   branch. It was used in the CCv0 branch.

2. Add default false values for the remaining Kata Agent ttrpc
   requests.

These changes don't change the functionality of the auto generated
Policy, but they help with easier understanding the Policy text and
the logging from the Rego rules.

Fixes: #9049

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-08 02:21:58 +00:00
Dan Mihai
535db6b29c
Merge pull request #9043 from ChengyuZhu6/assert
runtime-rs: fix assert error in `make check`
2024-02-07 18:19:18 -08:00
Dan Mihai
2bb91c9d8f
Merge pull request #8922 from microsoft/danmihai1/k8s-attach-handlers
tests: k8s-attach-handlers auto-generated policy
2024-02-07 13:29:50 -08:00
Dan Mihai
01745689e1
Merge pull request #9029 from microsoft/danmihai1/k8s-empty-dirs
genpolicy: mount source for non-confidential guest
2024-02-07 11:26:16 -08:00
Dan Mihai
6b5e57f7c7 tests: k8s: address PR review feedback
1. Rename install_kata_common to install_kata_core.

2. Add TODO for better way to install the Kata tools.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 18:51:56 +00:00
Steve Horsman
934d8dca0f
Merge pull request #9045 from ChengyuZhu6/nydus-version
nydus: Bump nydus snapshotter version to v0.13.7
2024-02-07 17:20:21 +00:00
Pavel Mores
6346e04cf7 runtime-rs: fix handling of TTRCP_ADDRESS
Since cri-o doesn't seem to use address for event publishing as mentioned
in the previous commit it will not send it.  However, the exact way of
not sending it is unfortunately different from what is assumed by
runtime-rs.  Due to an implementation detail of cri-o which uses containerd
libraries for some low-level tasks, TTRPC_ADDRESS will not be missing from
environment as assumed, instead it will be present with an empty value.

This commit contains a small adjustment to account for that and use
LogForwarder even if TTRPC_ADDRESS is present, but with an empty value.

Fixes #8985

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-02-07 17:01:04 +01:00
Gabriela Cervantes
ff1ace1c74 docs: Remove jenkins reference in kernel documentation
This PR removes the jenkins reference which is not longer being used
in the kernel documentation.

Fixes #9046

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-02-07 15:44:07 +00:00
ChengyuZhu6
d0b8e6d8f3 nydus: Bump nydus snapshotter version to v0.13.7
Bump nydus snapshotter version to v0.13.7.
The new release name of nydus snapshotter is `nydus-snapshotter-v0.13.7-linux-amd64.tar.gz`,
which differs from the version used by kata (`nydus-snapshotter-v0.12.0-x86_64.tgz`).
Therefore, we need to update the script to obtain the correct nydus snapshotter name.

Fixes: #9044

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2024-02-07 22:17:05 +08:00
ChengyuZhu6
34c47e08b2 runtime-rs: fix assert error in test in make check
Fix assert error:
error: used `assert_eq!` with a literal bool
   --> crates/hypervisor/src/ch/inner.rs:218:9
    |
218 |         assert_eq!(state.jailed, false);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison
    = note: `-D clippy::bool-assert-comparison` implied by `-D warnings`

Fixes: #9042

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2024-02-07 19:31:10 +08:00
Archana Shinde
d9ce88ada3
Merge pull request #8704 from amshinde/runtime-rs-clh-implement-persist
runtime-rs: implement persist api for cloud-hypervisor
2024-02-07 02:29:33 -08:00
Dan Mihai
dd16bc393f tests: k8s: k8s-attach-handlers generated policy
Automatically generate the test policy for k8s-attach-handlers.bats,
if AUTO_GENERATE_POLICY is enabled.

Steps:

- Create a temporary directory for the current test and copy the
  common genpolicy settings into this new directory.

- Change genpolicy settings in the temp directory to allow the
  "kubectl exec" command that this test needs. (For CoCo, exec is
  blocked by the default policy settings)

- Auto-generate the policy for the test YAML file.

- Test as usual, using the YAML file.

- Clean-up the temporary settings described above.

Fixes: #8921

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:26:03 +00:00
Dan Mihai
0de407f8b7 tests: k8s: enable AUTO_GENERATE_POLICY
Enable AUTO_GENERATE_POLICY for one of the Kata CI K8s test platforms.
Additional platforms will be enabled after testing them.

When AUTO_GENERATE_POLICY is enabled, create genpolicy settings that
are common for all tests. Some of the tests will make temporary copies
of these common settings and customize them as needed.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:25:54 +00:00
Dan Mihai
05b2e4f606 tests: k8s: install genpolicy
Install the genpolicy app before starting test execution.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:25:42 +00:00
Dan Mihai
8aa8b70573 tests: k8s: add policy test utilities
Add script functions useful for auto-generating and testing policy.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:24:06 +00:00
Dan Mihai
24a17a2e1b tests: k8s: output the names of test files
Output the names of test files, for easier search through logs.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:23:54 +00:00
Dan Mihai
bf533de31a tests: k8s: add DEBUG support for test scripts
Make these scripts easier to debug.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:23:46 +00:00
Dan Mihai
1b4ef672ef tests: k8s: reduce namespace name duplication
1. Avoid repeating "kata-containers-k8s-tests".
2. Allow users to specify a different test namespace.
3. Introduce the TEST_CLUSTER_NAMESPACE variable, that will also be
   useful when auto-generating the Agent Policy for these tests.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:23:38 +00:00
Dan Mihai
8a5ba5fb34 tests: k8s: allow run_kubernetes_tests.sh exec
Allow everyone to directly execute run_kubernetes_tests.sh, for easier
local testing.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-07 02:23:30 +00:00
Fabiano Fidêncio
11ba90ebf2
Merge pull request #8958 from fidencio/topic/kata-manager-nerdctl-support
kata-manager: Add support for nerdctl installation
2024-02-06 21:33:48 +01:00
GabyCT
d74b6e143f
Merge pull request #8951 from GabyCT/topic/udf
metrics: Update packages for TensorFlow ResNet Int8 Dockerfile
2024-02-06 14:29:41 -06:00
GabyCT
6337f300a8
Merge pull request #8628 from GabyCT/topic/enablek8stclh
tests: k8s: Enable tests for cloud hypervisor runtime-rs without devicemapper
2024-02-06 14:28:35 -06:00
Niteesh Dubey
3e383674f8 runtime: fix creation of SEV confidential container on SNP enabled host.
This is needed to fix the bug which is not allowing to create SEV container
on SNP enabled host anymore. This is a regression that was introduced as
part of the following commit:
de39fb7d38

Fixes: #9036

Signed-off-by: Niteesh Dubey <niteesh@us.ibm.com>
2024-02-06 19:01:30 +00:00
Hyounggyu Choi
462afcf829 runtime-rs: Copy configuration for QEMU from runtime
It makes sense to reuse a configuration template for runtime-golang
as a base. This is simply to copy it into the config directory.

Fixes: #8441

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-02-06 19:35:44 +01:00
Fabiano Fidêncio
058f068d67
Merge pull request #9020 from BbolroC/ok-to-test-static-checks-but-x86
gha: Run static-checks on self-hosted runners conditionally
2024-02-06 19:30:21 +01:00
Gabriela Cervantes
cf049fc718 k8s: Skip k8s tests that are not working
This PR skips the k8s tests that are not working with cloud hypervisor
runtime-rs with its proper issue.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-02-06 16:52:02 +00:00
Pavel Mores
f0256fded5 runtime-rs: remove validation of shim v2 -address value
It appears that under the shim v2 protocol, a shim has no use of its own
for the -address value, it just passes it back to container runtime's
(mostly containerd or cri-o) event-publishing binary.  Since the -address
value only flows through the shim, being passed to the shim by a container
runtime and then essentially passed back by shim to the container runtime,
it seems inappropriate for a shim to validate the value that is fully
owned and only used by the container runtime.

This commit removes such validation from runtime-rs.  Doing so, it solves
(part of) an interoperability problem between runtime-rs and cri-o.  cri-o
seems to intentionally choose not to implement the event-publishing part
of the shim v2 protocol and thus it has no value it could pass to
runtime-rs for -address.  As a result, it sends an empty string which has
been failing the excessive validation performed by runtime-rs so far.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-02-06 13:43:09 +01:00
Wainer Moschetta
f1ca5d1563
Merge pull request #8953 from ChengyuZhu6/ci-guest-pull
gha: Enable nydus snapshotter in CoCo ci tests
2024-02-06 09:36:59 -03:00
Fabiano Fidêncio
1ccb850ee7
Merge pull request #9027 from fidencio/topic/add-libattest-tdx-into-the-confidential-rootfs
rootfs: Add libattest-tdx into the confidential rootfs
2024-02-06 12:52:13 +01:00
Fabiano Fidêncio
ce82b5e3f5
rootfs: Add libtdx-attest into the confidential rootfs
This is required as the tdx-attest-rs crate, which is used as part of
the guest components, has a runtime dependency on libattest-tdx.

Fixes: #9021 -- part II

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-06 09:13:49 +01:00
Xuewei Niu
67d9847fac
Merge pull request #9025 from wainersm/cri-containerd_fix_loop
cri-containerd: fix loop in TestContainerMemoryUpdate()
2024-02-06 14:49:57 +08:00
Amulya Meka
354a3093fa
Merge pull request #9019 from Amulyam24/k8s-fix
gha: add GOPATH env var to the ppc64le k8s workflow
2024-02-06 11:01:49 +05:30
Alex Lyn
1ab9a21492
Merge pull request #8552 from deagon/fix/missing-port-type
runtime: missing port type in the DeviceInfo
2024-02-06 10:56:46 +08:00
Dan Mihai
473efc2149 genpolicy: mount source for non-confidential guest
The emergent Kata CI tests for Policy use confidential_guest = false
in genpolicy-settings.json. That value is inconsistent with the
following mount settings:

        "emptyDir": {
            "mount_type": "local",
            "mount_source": "^$(cpath)/$(sandbox-id)/local/",
            "mount_point": "^$(cpath)/$(sandbox-id)/local/",
            "driver": "local",
            "source": "local",
            "fstype": "local",
            "options": [
                "mode=0777"
            ]
        },

We need to keep those settings for confidential_guest = true, and
change confidential_guest = false to use:

        "emptyDir": {
            "mount_type": "local",
            "mount_source": "^$(cpath)/$(sandbox-id)/rootfs/local/",
            "mount_point": "^$(cpath)/$(sandbox-id)/local/",
            "driver": "local",
            "source": "local",
            "fstype": "local",
            "options": [
                "mode=0777"
            ]
        },

The value of the mount_source field is different.

This change unblocks testing using Kata CI's pod-empty-dir.yaml:

genpolicy -u -y pod-empty-dir.yaml

kubectl apply -f pod-empty-dir.yaml

k get pod sharevol-kata
NAME            READY   STATUS    RESTARTS   AGE
sharevol-kata   1/1     Running   0          53s

Fixes: #8887

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-02-06 01:19:48 +00:00
Fabiano Fidêncio
ffa190831d
Merge pull request #9022 from fidencio/topic/add-guest-components-to-the-confidential-image-and-initrd
rootfs: confidential: Install coco-guest-components
2024-02-05 18:56:48 +01:00
Hyounggyu Choi
40b2b2a43a gha: Run static-checks on self-hosted runners conditionally
Due to the restrictions on instance provisioning for self-hosted runners, performing
static checks (36 jobs at the time of writing) on them each time a PR is updated could
significantly burden them, consequently slowing down the entire CI system. To address
this, the decision is to trigger these checks only when an 'ok-to-test' label is added.
Meanwhile, the checks for x86_64, which are supported by GitHub-hosted runners, will
remain unchanged.

Fixes: #8998

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-02-05 15:24:21 +01:00