Commit Graph

12818 Commits

Author SHA1 Message Date
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
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
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
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
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
Wainer dos Santos Moschetta
106e1af497 cri-containerd: fix loop in TestContainerMemoryUpdate()
The loop that generate test cases for virtio-mem enabled/disabled
doesn't return the integers '1' and '0' as expected. Instead it returns
the strings '{1,' and '0}'.

Fixes #9024
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-02-05 10:59:39 -03:00
Fabiano Fidêncio
27e7974048
rootfs: confidential: Install coco-guest-components
Let's install the coco-guest-components into the confidential rootfs
image and initrd.

Fixes: #9021

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-05 14:41:29 +01:00
Fabiano Fidêncio
f80dbcee0e
rootfs: Add logging about the coco guest components
This will make our lives easier to figure out whether the components are
being installed or not.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-05 14:41:29 +01:00
Fabiano Fidêncio
68b8186ec4
osbuilder: Expose COCOGUEST_COMPONENTS_TARBALL
We need to pass this to the container where the rootfs is built, so it
can actually be unpacked inside the rootfs.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-05 14:41:28 +01:00
Fabiano Fidêncio
64d09874c3
packaging: coco-guest-components: Pass DESTDIR to the build script
As DESTDIR was not being passed, we've been installing the final
binaries in a container path that was not exposed to the host, leading
to creating an empty tarball with the guest components.

Now, theoretically, guest-components should respect a PREFIX passed, but
that's not the case and we're manually adding "/usr/local/bin" to the
passed DESTDIR.

Here's the result of the tarball:
```bash
⋊> kata-containers ≡ tar tf build/kata-static-coco-guest-components.tar.xz
./
./usr/
./usr/local/
./usr/local/bin/
./usr/local/bin/confidential-data-hub
./usr/local/bin/attestation-agent
./usr/local/bin/api-server-rest
```

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-05 14:07:10 +01:00
ChengyuZhu6
a214bd8d13 gha: Enable nydus snapshotter in CoCo ci tests
This PR is a split of #8585.
make the changes on the Github workflows, and the skeleton to deploy_snapshotter()
and cleanup_snapshotter() in tests/integration/kubernetes/gha-run.sh in this commit.

After initially merging this patch to trigger CI jobs for CoCo, which will begin executing
the dummy functions deploy_snapshotter() and cleanup_snapshotter(), the implementation details for these functions
remain in #8585. Our subsequent step involves transferring this logic to the PR #8484, enabling the PR to undergo CI testing prior to its merge.

Fixes: #8997

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2024-02-05 18:51:59 +08:00
Fabiano Fidêncio
1362918ff0
Merge pull request #9011 from fidencio/topic/switch-to-using-the-confidential-rootfs
runtime: Replace TEE specific initrd / image for the confidential one
2024-02-05 10:43:12 +01:00
Guoqiang Ding
6068faf40b runtime: failed to run in the case of ColdPlugVFIO
Add the missing port type in the DeviceInfo.

Fixes: #9014
Signed-off-by: Guoqiang Ding <dgq8211@gmail.com>
2024-02-05 17:30:11 +08:00
Fabiano Fidêncio
65013205ed
Merge pull request #9005 from ChengyuZhu6/clang
static-checks: Install clang in the ci environments
2024-02-05 09:24:51 +01:00
Archana Shinde
b3c74411f6 runtime-rs: Add tests for persist api for clh
Add tests to check clh struct is saved/restored correctly.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2024-02-04 22:03:57 -08:00
Archana Shinde
0b78296dca runtime-rs: Store additional field for hypervisor state
Implementing Persist API for cloud-hypervisor was done partially with
initial support for cloud-hypervisor. Store and retrieve additional
fields to/from the hypervisor state.

Fixes: #6202

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2024-02-04 22:03:57 -08:00
Archana Shinde
a5f0b92bca runtime-rs: Add guest protection to hypervisor state
Store guest-protection used while storing the state of the hypervisor.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2024-02-04 22:03:54 -08:00
Alex Lyn
cf74166d75
Merge pull request #9015 from Apokleos/bugfix-exec-uds
runtime: display accurate error msg to avoid misleading users.
2024-02-05 13:50:43 +08:00
Amulyam24
e59d005568 gha: add GOPATH env var to the ppc64le k8s workflow
The filtering of testing cases installs/uses yq and expects GOPATH to be present. Hence, add it to the workflow.

Fixes: #9018

Signed-off-by: Amulyam24 <amulmek1@in.ibm.com>
2024-02-05 10:30:10 +05:30
Alex Lyn
51a82bec3c
Merge pull request #9012 from deagon/fix/monitor-agent-url
kata-monitor: fix agentUrl from containerd shim
2024-02-05 10:41:56 +08:00
ChengyuZhu6
f354beb253 static-checks: Install clang in the ci environments
To test PR #8484, the compilation process for the kata-agent relies on clang.
There have been encountered failures on ARM, s390x, and ppc64le architectures:
ppc64le: https://github.com/kata-containers/kata-containers/actions/runs/7754082828/job/21146689026?pr=8484
s390x: https://github.com/kata-containers/kata-containers/actions/runs/7754082828/job/21146689401?pr=8484
arm: https://github.com/kata-containers/kata-containers/actions/runs/7754082828/job/21146689026?pr=8484

Fixes: #9004

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2024-02-04 17:00:19 +08:00
Alex Lyn
c6830ceb89 runtime: display accurate error msg to avoid misleading users.
The original handling method does not reach user expectations.
When the ClientSocketAddress method stats the corresponding
path of runtime-rs and has not found it yet, we should return
an error message here that includes the reason for the failure
(which should be an error display indicating that both runtime-go
and runtime-rs were not found). Instead of simply displaying the
corresponding path of runtime-rs as the final error message to
users.
It is also necessary to return the error promptly to the caller
for further error handling.

Fixes: #8999

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2024-02-04 16:45:59 +08:00
Xuewei Niu
fa01a86334
Merge pull request #9007 from wainersm/aks_delete_rg
gha: delete azure RG only if it exists
2024-02-04 16:34:17 +08:00
Guoqiang Ding
7bf1ebe16d kata-monitor: fix agentUrl from containerd shim
Fix the missing leading slash.

Fixes: #9013
Signed-off-by: Guoqiang Ding <dgq8211@gmail.com>
2024-02-04 16:24:13 +08:00
Fabiano Fidêncio
d4a9856a84
gha: Remove SEV / SNP / TDX images / initrds
We can remove this now that we're relying on the confidential one.

Fixes: #9010

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-03 13:22:07 +01:00
Fabiano Fidêncio
e4258d8694
runtime: Use confidential image / initrd instead of TEE specific ones
Now that we have a confidential image / initrd being built, instead of a
specific one for each TEE, let's use it everywhere possible.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-02-03 13:20:14 +01:00
Fabiano Fidêncio
e0bb632053
Merge pull request #8983 from fidencio/topic/add-confidential-image
packaging: Add confidential image / initrd
2024-02-03 12:30:16 +01:00