Commit Graph

848 Commits

Author SHA1 Message Date
Fabiano Fidêncio
5b0d0687e5
packaging: agent: Allow building in all arches
We're moving away from alpine and using ubuntu in order to be able to
build the agent for all the architectures we need.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-25 19:41:32 +01:00
Fabiano Fidêncio
1039641ab8
packaging: agent: Add the arch to the builder container
This has been missed during reviews and is already a problem as we're
trying to build the agent outside of the rootfs for other architectures
than x86_64.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-25 14:11:14 +01:00
Fabiano Fidêncio
58874f9c3e
packaging: tools: Add the arch to the builder container
This has been missed during reviews and will become a problem when the
tools start to be built in different architectures.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-25 14:10:22 +01:00
Zvonko Kaiser
4fc34323ae gpu: Add NVIDIA GPU Confidential kernel target
This is a follow up to the work of minimizing targets, unifying TDX,SNP builds for NVIDIA GPUs

Fixes: #8828

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2024-01-22 14:58:57 +00:00
Dan Mihai
febabef08c tools: install genpolicy settings files
Install the default genpolicy OPA rules and settings JSON files, in
addition to the genpolicy binary.

Fixes: #8844

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-01-16 23:59:59 +00:00
Dan Mihai
201eec628a tools: genpolicy static checks
Package genpolicy and enable static checks for it.

Fixes: #8813

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-01-15 16:49:58 +00:00
Fabiano Fidêncio
c3f6eaa267
build-kernel: Fix typo 'terball' -> 'tarball'
SSIA. :-)

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-09 14:35:45 -03:00
Fabiano Fidêncio
8b2f43a2c2
build: Add "confidential" kernel
We're using a Kernel based on v6.7, which should include all te
patches needed for SEV / SNP / TDX.

By doing this, later on, we'll be able to stop building the specific
kernel for each one of the targets we have for the TEEs.

Let's note that we've introduced the "confidential" target for the
kernel builder script, while the TEE specific builds are being kept as
they're -- at least for now.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-09 14:35:45 -03:00
Jianyong Wu
379e2f3da2
kernel: update some configs based on kernel 6.5 and 6.6
There are lots of configs removed from latest kernel. Update them here
for convenience of next kernel upgrade.

Remove CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE [1]
Remove CONFIG_IP_NF_TARGET_CLUSTERIP [2]
Remove CONFIG_NET_SCH_CBQ [3]
Remove CONFIG_AUTOFS4_FS [4]
Remove CONFIG_EMBEDDED [5]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.6&id=a7e4676e8e2cb158a4d24123de778087955e1b36
[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.6&id=9db5d918e2c07fa09fab18bc7addf3408da0c76f
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.6&id=051d442098421c28c7951625652f61b1e15c4bd5
[4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.6&id=1f2190d6b7112d22d3f8dfeca16a2f6a2f51444e
[5] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.6&id=ef815d2cba782e96b9aad9483523d474ed41c62a

Fixes: #8408
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2024-01-09 14:35:45 -03:00
Fabiano Fidêncio
cf4835e3ae
packaging: qemu: Simplify "--disable-virtiofsd" logic
As all the supported architectures are disabling the virtiofsd build,
there's no need to keep the switch statement there.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-09 14:35:45 -03:00
Fabiano Fidêncio
bfc6fc7a85
build: Get rid of QEMU experimental
We've not been building QEMU experimental for a very long time, and the
entry there has only been serving the purpose to clutter the
versions.yaml (in the best case scenario) or even confuse new
contributors to the project.

Mind that the machinery to build the QEMU experimental is not touched,
and that's used to build the TEEs capabale artefacts.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2024-01-09 14:35:45 -03:00
Gabriela Cervantes
7d41c97f60 packaging: Fix indentation of build static stratovirt
This PR fixes the indentation of the build static stratovirt script
for kata containers.

Fixes #8777

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-01-05 18:06:08 +00:00
Zhigang Wang
44b5b88f4c docs: Update docs for new StratoVirt VMM introduction
As the StratoVirt VMM has been added, we can update the docs
and make some intoduction to StratoVirt, thus users can know more
about the hypervisor choices.

Fixes: #8645

Signed-off-by: Zhigang Wang <wangzhigang17@huawei.com>
Signed-off-by: Liu Wenyuan <liuwenyuan9@huawei.com>
2024-01-04 14:26:48 +08:00
Chao Wu
f9e0a4bd7e upcall: introduce pci device add & del kernel patch
add pci add and del guest kernel patch as the extension
in the upcall device manager server side.

also, dump config version to 120 since we need to add config
for dragonball pci in upcall

fixes: #8741

Signed-off-by: Gerry Liu <gerry@linux.alibaba.com>
Signed-off-by: Helin Guo <helinguo@linux.alibaba.com>
Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
2023-12-28 16:21:30 +08:00
Fabiano Fidêncio
6ee7fb5402
kata-deploy: Double quote the snapshotter name
Otherwise `jq` will complain about:
```sh
jq: error: nydus/0 is not defined at <top-level>, line 1:
.plugins."io.containerd.grpc.v1.cri".containerd.runtimes."kata-clh".snapshotter=nydus
jq: 1 compile error
```

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-26 09:14:36 -03:00
Fabiano Fidêncio
8332f3c684
kata-deploy: Fix the snapshotter config placement
In the way the script is without this patch, we're trying to set
```toml
[`$shim`]
snapshotter = $snapshotter
```

However, what we actually want to set is the full runtime table instead
of shim.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-26 08:26:38 -03:00
Fabiano Fidêncio
907f1ddb9e
kata-deploy: Fix shim check for snapshotter configuration
We want to check whether the shim is part of the "plain text" shims
passed to the daemonset (meaning, checking against `$SHIMS`).  Before
this fix we were checking against `$shims`, which is an array of shims
instead of a string, resulting on a broken check.

Fixes: #8732

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-26 07:42:36 -03:00
Bin Liu
23eb3042c7 kata-monitor: fix Dockerfile to build image
move `SKIP_GO_VERSION_CHECK` after `make` command to skip
checking golang version.

And also upgrade golang to 1.19.

Fixes: #8728

Signed-off-by: Bin Liu <bin@hyper.sh>
2023-12-26 15:11:13 +08:00
stevenhorsman
4a95c0d07f kata-deploy: snapshotter typo fixes
- Add spaces so that the if statements are valid

Fixes: #8720
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-12-22 16:32:02 +00:00
Fabiano Fidêncio
6cc6ca5a7f
kata-deploy: Allow setting up snapshotters per runtime handler
Since containerd 1.7.0 we can easily set a specific snapshotter to be
used with a runtime handler, and we should take advantage of this,
mostly as it'll help setting up any runtime using devmapper or nydus
snapshotters.

This implementation here has a few caveats:
* The format expected for the SNAPSHOTTER_HANDLER_MAPPING is:
  `shim:snapshotter,shim:snapshotter,...`
* It only works with containerd 1.7 or newer
* We **never** change the default containerd snapshotter
* We don't do any check on our side to verify whether the snapshotter
  required is properly deployed
* Users will have to add an annotation to their pods, in order to use
  the snapshotter set up per runtime handler
  * Example:
    ```
    metadata:
      ...
      annotations:
        io.containerd.cri.runtime-handler: kata-fc
    ```

Fixes: #8615

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-21 07:20:10 -03:00
Fabiano Fidêncio
c9e631dc0c
kata-deploy: Reapply "kata-deploy: Use tomlq to configure containerd"
This reverts commit ee5fa08a27.

This is perfectly fine to do as we narrwoed down the issue to be on the
version of `jq` provided by alpine, and we've already updated it in the
previous commit (in this very same series).

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-20 12:52:41 -03:00
Fabiano Fidêncio
41320c586e
kata-deploy: Install jq from GitHub
`jq` coming from alpine is in its 1.6 version, and that has a bug that
hits us quite hard, as it changes a float to an int whenever the number
is in the `x.0` format.

One example is:
```bash
/ # jq --version
jq-1.6
/ # echo '{"foo": 1.0}' | jq .foo
1
```

With this in mind, let's switch, at least for now, to using the `jq`
released directly on github, as it does address the issue we've been
hitting.
```bash
⋊> Downloads ./jq-linux-amd64 --version
jq-1.7
⋊> Downloads echo '{"foo": 1.0}' | jq .foo
1.0
```

Fixes: #8678

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-20 12:52:41 -03:00
stevenhorsman
ee5fa08a27 Revert "kata-deploy: Use tomlq to configure containerd"
This reverts commit dd9f5b07b9.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-12-20 09:10:43 +00:00
Fabiano Fidêncio
7ad873cf29
kata-deploy: Simplify shim configuration
We never have to add a configuration for the "default" case, as we're
already creating the runtime class pointing to what should be the
"default" handler.

This helps to simplify the logic by quite a lot.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-13 10:52:54 +01:00
Fabiano Fidêncio
e618949937
kata-deploy: Remove useless comment from CRI-O drop-in
The comment adds absolutely nothing to the runtime handler added, and
it'd make our life slightly harder to properly say which VMM is being
used when setting the default `kata` handler.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-13 10:49:52 +01:00
Fabiano Fidêncio
dd9f5b07b9
kata-deploy: Use tomlq to configure containerd
This save us a lot of trouble on properly sed'ing content that may or
may not be in the containerd configuration file.

Fixes: #8638

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-13 10:49:49 +01:00
Fabiano Fidêncio
4f01f294bb
kata-deploy: Install tomlq to the base image
This will help us to have an easier time playing with the containerd
configuration, instead of having to sed the **** out of it, which is
super error prone.

`tomlq` is a tool that comes from https://github.com/kislyuk/yq, and
that depends on `jq` to do the toml parsing / editing.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-13 10:49:07 +01:00
Fabiano Fidêncio
39f5cea3b1
kata-deploy: Fix k0s cri notation comment
We can safely assume we're using the *newer* notation, not the *older*
one.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-12 18:20:18 +01:00
Hyounggyu Choi
28c3e0e5f0 GHA: Fix kata-deploy-runtime-classes-check for kata-qemu-se
This is to fix an error on kata-deploy-runtime-classes-check for kata-qemu-se.

Fixes: #8623

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-11 10:30:00 +01:00
Chelsea Mafrica
1c42d94550
Merge pull request #6826 from gabevenberg/log-parser-rs
kata-ctl: Moved log-parser-rs into kata-ctl
2023-12-08 11:33:09 -08:00
Hyounggyu Choi
588f639a69
Merge pull request #6755 from BbolroC/add-se-artifacts-to-main
packaging: Add IBM Z SE artifacts to main
2023-12-08 05:17:38 +01:00
Gabe Venberg
69fdd05ce5 kata-ctl: Moved log-parser-rs into kata-ctl
Log-parser-rs was always intended to become a sub-functionality of
kata-ctl, but it was useful to develop it and initaly merge it as a
standalone program, and migrate it to a subcommand later.

Fixes #6797

Signed-off-by: Gabe Venberg <gabevenberg@gmail.com>
2023-12-07 21:35:28 -06:00
Hyounggyu Choi
31db56207b local-build: add support for key verification for IBM Secure Execution
This is to make `build_se_image.sh` incorporate the key verification originally supported by `genprotimg`.
It can be achieved by specifying two environment variables called `SIGNING_KEY_CERT_PATH` and `INTERMEDIATE_CA_CERT_PATH`.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-07 20:05:40 +01:00
Hyounggyu Choi
52bdc87fe9 local-build: make kernel parameters configurable
This is to make kernel parameters configurable during the secure image build by adding an environment variable SE_KERNEL_PARAMS.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-07 20:05:40 +01:00
Hyounggyu Choi
9ceb2c27e0 local-build: consider cross-compilation env
This is to make a base builder image build genprotimg without a package
manager under the cross-compilation environment.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-07 20:05:40 +01:00
Zvonko Kaiser
16380558e0 deployment: Create a stable overaly for kata-deploy
Fixes: #8508

Create a stable overlay for kata-deploy.yaml so we do not have to maintain two files, only one.
Single source for both. This is also preparation for the helm-overlay

Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
2023-12-06 14:23:22 +00:00
Fabiano Fidêncio
d149b9f9ca
Merge pull request #7231 from wainersm/measured_rootfs-improvements
Build for measured rootfs improvements
2023-12-05 22:20:33 +01:00
Hyounggyu Choi
511dd5feac local-build: add support to build IBM Z SE image
This is to add an artifact for IBM Z SE(TEE) to main.

Fixes: #6754

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-04 21:08:51 +01:00
Hyounggyu Choi
4de8ef3d18 local-build: add build target boot-image-se
This is to add a build target boot-image-se for s390x.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-04 21:08:51 +01:00
Hyounggyu Choi
a63a6959d1 local-build: install s390-tools in Dockerfile
This is to install s390-tools including genprotimg during the docker
build.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-04 21:08:51 +01:00
Hyounggyu Choi
8de4241d3b kata-deploy: add kata-qemu-se runtimeclass
This is to increase resources for relaxing the limitation of hotplug for
SE.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-04 21:06:53 +01:00
Hyounggyu Choi
9ede2bcd95 local-build: differentiate build targets based on architecture
This is to rule out unnecessary build targets for s390x.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-12-04 21:06:53 +01:00
Fabiano Fidêncio
03c3f4275e kernel: Add CONFIG_TDX_GUEST_DRIVER to the tdx.conf
The driver enables the userspace interface to communicate with the TDX
module to request the TDX guest details, like the attestation report.

Fixes: #8555

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-12-04 10:25:59 +01:00
James O. D. Hunt
158ca17ae7 kata-deploy: Add cloud-hypervisor
Now that we have a separate Cloud Hypervisor configuration file for the
rust runtime, add it to the kata-deploy.

See: https://github.com/kata-containers/kata-containers/pull/8250

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-28 18:02:06 +01:00
Fabiano Fidêncio
d4e00238ab kata-deploy: Improve the logic for linking to the rust runtime
This change for now doesn't do much, apart from making it easier to
expand which runtimes should be linked to the runtime-rs containerd shim
binary.

Also, this matches the logic used for the config files.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-11-28 18:01:27 +01:00
James O. D. Hunt
fc28deee0e kata-deploy: Use rust runtime config files in runtime-rs directory
Update `kata-deploy` to modify the rust runtime configuration files in
their new `runtime-rs/` directory.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2023-11-28 18:01:25 +01:00
Wainer dos Santos Moschetta
a13eecf7f3 runtime(-rs): add clean-generated-files target
The new clean-generated-files make target allows for removing the
generated files (including the configuration.toml files).

The tools/packaging/static-build/shim-v2/build.sh script now uses that
target to always force the re-generation of those files.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2023-11-28 11:21:53 -03:00
Wainer dos Santos Moschetta
ba4f806c30 initramfs: re-wrote devices checking on init.sh
Re-wrote the logic of init.sh to follow the rules:

 * the root device MUST exist always because it will be either mounted
   or verified (then mounted)
 * if rootfs verifier is enabled then the hash device MUST exist. Avoid
   the case where dm-verity is set but the hash device does not exist and
   so the verification is silently skipped

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2023-11-28 11:21:53 -03:00
Wainer dos Santos Moschetta
72ef82368c shim-v2: ensure root hash exist when measured rootfs
When measured toofs is enabled then the shim-v2 build should find the
guest rootfs hash file, otherwise might (silently) generate configuration
files with empty hash.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2023-11-28 11:21:53 -03:00
Wainer dos Santos Moschetta
1465e58854 kernel: ensure initramfs exist when measured rootfs
The KATA_BUILD_CC variable plus the existence (or not) of the initramfs
were used to determine whether to build the kernel for measured rootfs
or not. Currently the variable MEASURED_ROOTFS has been used
to trigger the feature build and when it is activated it should expect
the initramfs exist. In other words, this changed the kernel build
so that if `MEASURED_ROOTFS=yes` then the initramf file must exist and
be found.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2023-11-28 11:21:53 -03:00