Commit Graph

13050 Commits

Author SHA1 Message Date
Linda Yu
eda419cb03 kata-runtime: add set policy function to kata-runtime
logging/debugging information might probably be disabled in production
due to security consideration, but we'd better provide an approach for
customer to get logging information during runtime, this PR implement
setpolicy function in kata-runtime tools, although it can set whole policy
other than logging.
setpolicy would evokes remote attestation, which means before setting
policy during runtime, user has to reconfigure new policy hash in KBS/AS.

usage:  kata-runtime policy set policy.rego --sandbox-id XXXXXXXX

Fixes: #8797

Signed-off-by: Linda Yu <linda.yu@intel.com>
2024-03-07 15:00:23 +08:00
Dan Mihai
73a8b61c2e
Merge pull request #9243 from microsoft/danmihai1/genpolicy-unblock-ci
genpolicy: disable env variable verification
2024-03-06 21:44:18 -08:00
Dan Mihai
e61ef30a76 genpolicy: disable env variable verification
Disable env variable verification to unblock CI, until container
images that don't specify the Env variables will be handled correctly
(see #9239).

Also, mark the image config Env field as optional, thus allowing
policy generation for these container images.

Fixes: #9240

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-03-07 01:59:18 +00:00
GabyCT
640ed591bd
Merge pull request #9219 from GabyCT/topic/fixkerneldoc
docs: Remove stale kernel information at README documentation
2024-03-06 10:24:31 -06:00
Ryan Savino
fdfc825bc4
Merge pull request #9174 from ryansavino/snp-qemu-stable-coco-tag
versions: SNP qemu updated to stable coco tagged version
2024-03-06 01:03:10 -06:00
GabyCT
83e39a206c
Merge pull request #9223 from jodh-intel/tests-add-k3s-artifacts
tests: Add k3s artifacts
2024-03-05 13:37:21 -06:00
James O. D. Hunt
a67ed2f1c2 tests: Add k3s artifacts
The k3s distribution of k8s uses an embedded version of containerd and
configures it to log to a file, not the journal. Hence, although we
collect the journal as a test artifact, we also need to collect the
actual log files for containerd.

Also collect the k3s containerd config files to help with debugging.

Fixes: #9104.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-05 17:54:20 +00:00
GabyCT
9fab57acc8
Merge pull request #9217 from wainersm/revert_collect_artifacts
gha: export start_time to collect artifacts properly
2024-03-05 11:11:49 -06:00
Gabriela Cervantes
12be4cf828 docs: Remove stale kernel information at README documentation
This PR removes stale kernel information at README documentation.

Fixes #9218

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-05 16:46:45 +00:00
Wainer dos Santos Moschetta
9ba5e3d2a8 gha: export start_time to collect artifacts properly
The jobs running on garm will collect journal information. The data gathered
is based on the time the tests started running. The $start_time is
exported on run_tests() and used in collect_artifacts(). It happens that
run_tests() and collect_artifacts() are called on different steps of the
workflow and the environment variables aren't preserved between them,
i.e, $start_time exported on the first step is not available on the
subsequents.

To solve that issue, let's save $start_time in the file pointed out by
$GITHUB_ENV that Github actions uses to export variables. In case $GITHUB_ENV is
empty then probably it is running locally outside of Github, so it won't
save the start time value.

Fixes #9217
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-03-05 12:15:20 -03:00
James O. D. Hunt
b761a80bd1
Merge pull request #9059 from jodh-intel/kata-manager-add-hypervisor-option
kata-manager: Allow hypervisor to be changed
2024-03-05 09:30:04 +00:00
Alex Lyn
bf5edc8e73
Merge pull request #9155 from Jimmy-Xu/fix-build-gpu-kernel
gpu: fix build guest kernel with gpu
2024-03-05 16:53:44 +08:00
Greg Kurz
0320198889
Merge pull request #9206 from lifupan/main
CI: fix the issue of ci failure on crio
2024-03-05 09:52:13 +01:00
Fupan Li
628f57aca0
Merge pull request #9193 from UiPath/fix/clh-dax
clh: Enable DAX for rootfs
2024-03-05 09:39:22 +08:00
Wainer Moschetta
38088a934b
Merge pull request #9184 from wainersm/fix_kata_deploy_bats
tests/kata-deploy: fix checker for kata-deploy running
2024-03-04 20:50:37 -03:00
GabyCT
77d048da4d
Merge pull request #9065 from wainersm/ci_install_kbs
CI: Install KBS on k8s for attestation tests
2024-03-04 16:59:01 -06:00
GabyCT
a4153f3b71
Merge pull request #9210 from GabyCT/topic/addtestreadme
docs: Add general README for tests section
2024-03-04 16:54:28 -06:00
Gabriela Cervantes
5d50262422 docs: Add general tests documentation in main README
This PR adds the general tests documentation in main README of the
kata containers repository.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-04 21:53:01 +00:00
Gabriela Cervantes
d5fa2bebd5 docs: Add general README for tests section
This PR adds general README documentation for the tests section
in the kata containers repository.

Fixes #9209

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-04 21:50:37 +00:00
GabyCT
4dea9019ab
Merge pull request #9126 from GabyCT/topic/addartifactsk
gha: Storing artifacts for logs of k8s tests garm
2024-03-04 15:41:54 -06:00
Gabriela Cervantes
fc5e040d96 scripts: Apply general fixes to variables in gha-run script
This PR applies general fixes to variables in gha-run script.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-04 18:54:15 +00:00
James O. D. Hunt
7af892f8d8 docs: Update kata-manager docs for switching hypervisor
Add details to the README for `kata-manager` showing how to list
available hypervisor configs (packaged and local), and switch between
the configurations. Also, update the hypervisors page to show a lot more
detail about the hypervisor configurations, including the "short name"
used by `kata-manager` for switching hypervisor config.

> **Note:**
>
> These changes only apply to the current default golang runtime.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 12:24:31 +00:00
James O. D. Hunt
4f6fef1f61 docs: Whitespace fix
Remove extraneous whitespace from hypervisors doc.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 12:18:05 +00:00
James O. D. Hunt
1ac3caf656 kata-manager: Allow hypervisor to be changed
Add new options to allow the configured hypervisor to be changed:

- `-L`: List available _packaged_ hypervisor config short names.
- `-e`: List available _local_ hypervisor config names.
- `-H <hypervisor>`: Install Kata then switch to the specified hypervisor.
- `-S <hypervisor>`: Switch to the specified hypervisor (by config short name [Errors if Kata not installed]).

For example, to install Kata and configure it to use Cloud Hypervisor
with the golang Kata runtime:

```bash
$ kata-manager.sh -H clh
```

To switch back to the default hypervisor:

```bash
$ kata-manager.sh -S default
```

To show details of the available packaged configs:

```bash
$ kata-manager.sh -L
```

To show details of the local configs:

```bash
$ kata-manager.sh -e
```

> **Notes:**
>
> - This change **only** applies to the current default (golang) Kata runtime.
>
> - Although this is mainly for users wishing to switch hypervisor (by
>   changing the Kata config file to another of the packaged config files
>   provided for specific hypervisors), strictly it allows users to change
>   to _any_ config file. For example, if the user has a config file called
>   `/etc/kata-containers/configuration-my-custom-config.toml`, they could
>   switch to this by running:
>
>   ```bash
>   $ kata-manager.sh -S my-custom-config
>   ```
>
> - The "config short names" are the hypervisor specific part of the configuration file name.
>   For example, the config short name for file `configuration-qemu.toml` is
>   `qemu` and the config short name for `configuration-clh.toml` is `clh`.

Fixes: #8305.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 12:18:00 +00:00
James O. D. Hunt
0bb558c0b9 kata-manager: Fix symlink handling
The `configure_kata()` function modifies the configuration file to
enable debug. But it was doing this by calling `sed -i` which, by
default, creates a new _file_ from the `configuration.toml` symbolic
link. This defeated the point of the symbolic link which is supposed to
resolve to the local copy of the pristine config file, so we now use
the GNU sed(1) specific `---follow-symlinks` option to retain the
sym-link.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
James O. D. Hunt
455637b30a kata-manager: Show message when checking file
Add an info message just before the archive file is checked. This keeps
the user informed about what is happening as it can take a few seconds
to perform the checks on slower systems.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
James O. D. Hunt
ce350450e8 kata-manager: Sort options in usage
Ensure the usage statement lists all options in alphabetical order.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
James O. D. Hunt
159d29665a kata-manager: Whitespace fixes
Remove extraneous whitespace.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2024-03-04 11:15:39 +00:00
Jimmy-Xu
5ada7329b8 gpu: fix build guest kernel with nvidia gpu
- enable CONFIG_MTRR,CONFIG_X86_PAT on x86_64 for nvidia gpu
- optimize -f of build-kernel.sh, clean old kernel path and config before setup
- add kernel 5.16.x

Fixes: #9143

Signed-off-by: Jimmy-Xu <xjimmyshcn@gmail.com>
2024-03-04 09:40:42 +08:00
Fupan Li
07e0cf1855 CI: fix the issue of ci failure on crio
PR #8760 tentatively tried to have the shim to run in its own mount
namespace for the sake of improving isolation between the sandbox and
the host. Thus crio storage drivers shouldn't create a PRIVATE
bind mount on their home directory. Otherwise, the container's rootfs
mount wouldn't be propagated to kata runtime's mount namespace, and
kata runtime couldn't access the container's rootfs files.

So, when kata cooperated with crio, crio should set
skip_mount_home=true for its storage overlay.

Fixes: #9028

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2024-03-03 20:53:36 +08:00
Wainer dos Santos Moschetta
2c24977cb1 tests/k8s: allow to overwrite the cluster name
_print_cluster_name() create a string based information like the
pull request number and commit SHA. However, when you are developing the
scripts you might want to use an arbitrary name, so it was introduced
the $AKS_NAME variable that once exported it will overwrite the
generated name.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-03-02 12:42:35 -03:00
Wainer dos Santos Moschetta
5e4b7bbd04 tests/k8s: expose KBS service externally
Until this point the deployed KBS service is only reachable from within
the cluster. This introduces a generic mechanism to apply an Ingress
configuration to expose the service externally.

The first implemened ingress is for AKS. In case the HTTP application
routing isn't enabled in the cluster (this is required for ingress), an
add-on is applied.

It was added the get_cluster_specific_dns_zone() and
enable_cluster_http_application_routing() helper functions
to gha-run-k8s-common.sh.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-03-02 12:42:35 -03:00
Wainer dos Santos Moschetta
e1e0b94975 tests/k8s: introduce the CoCo kbs library
Introduce the tests/integration/kubernetes/confidential_kbs.sh library
that contains functions to manage the KBS on CI. Initially implemented
the kbs_k8s_deploy() and kbs_k8s_delete() functions to, respectively,
deploy and delete KBS on Kubernetes. Also hooked those functions in the
tests/integration/kubernetes/gha-run.sh script to follow the convention
of running commands from Github Workflows:

$ .tests/integration/kubernetes/gha-run.sh deploy-coco-kbs
$ .tests/integration/kubernetes/gha-run.sh delete-coco-kbs

Fixes #9058
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-03-02 12:39:26 -03:00
Wainer dos Santos Moschetta
6a28c94d99 tests/k8s: add a kustomize installer
Kustomize has been used on some of our internal components (e.g.
kata-deploy) to manage k8s deployments. On CI it has been used
the `sed` tool to edit kustomization.yaml files, but `kustomize` is
more suitable for that purpose. So in order to use that tool on CI
scripts in the future, this commit introduces the `install_kustomize()`
function that is going to download and install the binary in
/usr/local/bin in case it's found on $PATH.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-03-02 12:39:26 -03:00
Xuewei Niu
daab76de36
Merge pull request #9201 from liubogithub/liubo/dev/panic_fix_3
katautils: fix panic on tracing.
2024-03-02 10:27:02 +08:00
GabyCT
4a0cfc4e3f
Merge pull request #9199 from GabyCT/topic/enablecri
gha: Enable cri-containerd tests for cloud hypervisor runtime-rs
2024-03-01 12:23:16 -06:00
Steve Horsman
1ec33b8879
Merge pull request #9200 from wainersm/ci_install_kbs-timeout
gha: increase timeout of KBS steps
2024-03-01 16:00:21 +00:00
Gabriela Cervantes
7299dbdb43 gha: Store journalctl logs
This PR stores the journalctl logs.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-01 15:17:20 +00:00
Gabriela Cervantes
342d3a320d gha: Add collect artifacts function in gha-run script
This PR adds the collect artifacts function in gha-run script for
the kubernetes tests.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-01 15:17:20 +00:00
Gabriela Cervantes
2070e3481e gha: Storing artifacts for logs of k8s tests garm
This PR helps to store the artifacts for different logs for k8s tests
on garm.

Fixes #9103

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-03-01 15:17:20 +00:00
Greg Kurz
df17bf95d5
Merge pull request #9169 from ldoktor/backport-ocp
ci.ocp: Backport service-up detection fixes
2024-03-01 16:09:55 +01:00
Greg Kurz
dc6bda19bf
Merge pull request #9179 from gkurz/fix-k8s-sandbox-vcpus-allocation-check
tests: k8s: Adapt k8s-sandbox-vcpus-allocation.bats to kubernetes v1.29
2024-03-01 15:55:07 +01:00
Lukáš Doktor
6fffbaa190
ci.ocp: Backport service-up detection fixes
This backports the:

9060e930caf2d20f413df07778d3ab497493161c

    ci.ocp: Add debug output on HTTP service failure

    these logs are vital to analyze a setup failure.

a10a1e2c9cbc21afc1e80f22b0fb8634d27cbd8d

    ci.ocp: Improve the service-up detection

    waiting for the first response is not sufficient as OCP returns html
    page without error even when the route is not yet established describing
    the issue (why it doesn't reply with 500?). Waiting for the correct
    output should do better.

commits from the kata-containers/tests repo.

Fixes: #8653

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
2024-03-01 12:04:20 +01:00
Alex Lyn
13a20957cb
Merge pull request #9164 from Apokleos/directvol-csi-dockerfile
csi-kata-directvolume: add Dockerfile for building csi image
2024-03-01 18:12:19 +08:00
Alex Lyn
f69428a1e7 csi-kata-directvolume: add Dockerfile for building csi image
Fixes: #9163

Signed-off-by: Alex Lyn <alex.lyn@antgroup.com>
2024-03-01 10:41:51 +08:00
Liu Bo
b6f8355ea3 katautils: fix panic on tracing.
This fixes a panic on tracing on container exit.

The root cause is that global var needs to be set by "=" instead of
":=".

Fixes: #9102

Signed-off-by: Liu Bo <liub.liubo@gmail.com>
2024-02-29 18:40:23 -08:00
Wainer dos Santos Moschetta
24c163e6e1 tests/kata-deploy: fix checker for kata-deploy running
Currently, the checking for kata-deploy is running assume that the
daemonset scheduled at least one pod, however it might not had and the
kubectl wait command fails due to "error: no matching resources found".

On CI I've observed that fail intermittently. I suspect the service
account kata-deploy-sa take a while to show up then no kata-deploy is
scheduled in meanwhile.

Changed the checker logic to use waitForProcess() to keep testing if it is
already running, or hit the timeout (still 10m).

Fixes #9183
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-02-29 22:26:27 -03:00
Wainer dos Santos Moschetta
4410df7233 gha: increase timeout of KBS steps
The step to deploy KBS on run-k8s-tests-on-aks workflow should be
increased so that there is enough time for checking the service is
healthy and exposed. Likewise the step that builds the kbs-client
which requires enough time to build the executable.

Fixes #9058
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2024-02-29 22:05:58 -03:00
Dan Mihai
11b603e5f1
Merge pull request #9139 from microsoft/saulparedes/genolicy_panic_subpath
genpolicy: panic when we see a volume mount subpath
2024-02-29 12:18:56 -08:00
Gabriela Cervantes
beb592b309 gha: Enable cri-containerd tests for cloud hypervisor runtime-rs
This PR enables the cri-containerd tests for cloud hypervisor runtime-rs.

Fixes #9198

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-02-29 20:18:16 +00:00