Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Support for bare-metal QEMU-TDX runtime deployment #611

Closed
wants to merge 17 commits into from

Conversation

msanft
Copy link
Contributor

@msanft msanft commented Jun 20, 2024

This adds initial support for deploying the Contrast runtime on bare-metal TDX machines with QEMU.

Notice that this does not yet contain full support for running Contrast on such platforms. Things that are left out as of now contain (non-comprehensive list):

  • TDX attestation
  • Policy generation and verification through the attestation
  • Snapshotter support (Nydus / Tardev)
  • Correct generation of the deployments with the right runtime handler name, which should be fixed with the follow-up for reading the runtime handler from the Manifest.

Due to the size of this PR, I encourage reviewers to see the commit messages for a more detailed description of what each commit does, and thus to review on a per-commit basis.

@msanft msanft added feature Shiny new feature for our users no changelog PRs not listed in the release notes and removed feature Shiny new feature for our users labels Jun 20, 2024
@msanft msanft force-pushed the msanft/kata-qemu-tdx-runtime branch 2 times, most recently from f69b435 to 5ad9592 Compare June 21, 2024 13:05
@msanft msanft changed the title Initial Support for Kata QEMU-TDX runtime Initial Support for Kata QEMU-TDX runtime deployment Jun 21, 2024
@msanft msanft changed the title Initial Support for Kata QEMU-TDX runtime deployment Initial Support for bare-metal QEMU-TDX runtime deployment Jun 21, 2024
@msanft msanft requested a review from burgerdev June 21, 2024 13:09
@msanft msanft force-pushed the msanft/kata-qemu-tdx-runtime branch from 5ad9592 to d2c9eb8 Compare June 21, 2024 13:10
@msanft msanft marked this pull request as ready for review June 21, 2024 13:10
@msanft msanft requested a review from katexochen as a code owner June 21, 2024 13:10
@katexochen katexochen self-assigned this Jun 21, 2024
@katexochen
Copy link
Member

PR is pretty big, can we split this into smaller chunks?

@msanft msanft force-pushed the msanft/kata-qemu-tdx-runtime branch from d2c9eb8 to 60fb9ee Compare June 21, 2024 13:21
@msanft
Copy link
Contributor Author

msanft commented Jun 21, 2024

PR is pretty big, can we split this into smaller chunks?

As mentioned in the PR description, I split this into digestible commits already. What benefit do you see in splitting this up into multiple PRs instead of reviewing each commit? I think the changes are quite entangled, so without a merge queue or set-merging, this would be hard to split into chunks that make sense on their own, but not break main.

Copy link
Member

@katexochen katexochen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also address the comments from #603

Reviewed up to and including 93b0165

packages/by-name/kata/runtime-class-files/package.nix Outdated Show resolved Hide resolved
internal/flavours/flavours.go Outdated Show resolved Hide resolved
internal/flavours/flavours.go Outdated Show resolved Hide resolved
internal/flavours/flavours.go Outdated Show resolved Hide resolved
@msanft msanft force-pushed the msanft/kata-qemu-tdx-runtime branch from 60fb9ee to b9c452f Compare June 26, 2024 09:42
@msanft
Copy link
Contributor Author

msanft commented Jun 26, 2024

Please also address the comments from #603

I think we should keep the pod-role annotation unique, as it is - besides the container image URL - the only way to see which installer is used.

@katexochen
Copy link
Member

I think we should keep the pod-role annotation unique, as it is - besides the container image URL - the only way to see which installer is used.

We can add another annotation with the string value of what is now called flavour instead.

msanft added 10 commits June 26, 2024 14:56
This migrates the runtime-class-files to the new directory structure, as they only contain Microsoft-specific components and thus should not live in the shared space.
This also pulls out the node installer image to the new directory structure, as it also only holds Microsoft-specific components. A future refactoring should make this share the lowest layer (i.e. the node installer binary itself) between flavour-specific node installers.
This packages the fileset required by the bare-metal kata runtime. For now, they are versioned in a makeshift content-addressable fashion, but not by the actual launch digest (MRTD), as we cannot calculate it ahead-of-time yet. This way, we can still deploy multiple runtimes side-by-side, each having a fixed, but not precalculatable launch digest.
This packages the Contrast node installer for bare-metal into a container image containing the node installer as well as the required runtime files. This does not implement the actual flavoring of the node installer yet, which is to be done in a follow-up commit.
This enables the runtime in the actual Contrast binary to be configurable by specifying it as a separate input, which can be set to either Kata (for bare-metal) or microsoft (for AKS).
This adds a package that contains some common tooling for working with the different deployment flavours of Contrast.
This changes the node-installer in a way so that it accepts a flavour as it's argument, specifying where it's deployed. Furthermore, it adds support for installing the bare-metal QEMU TDX runtime components of Contrast, which will be done if the corresponding flavour is specified.
This adds conditional generation of the Kubernetes resources (i.e. the Contrast runtime) to the resourcegen tool.
Since the main consumer of the flavours is the node-installer, the package now lives here. It also has the benefit of not needing to rebuild the node-installer whenever Contrast changes, but the other way around (which should be the case way less often).
This adds a container push instruction for the Kata node installer.
msanft added 7 commits June 26, 2024 14:57
This changes the default snapshotter to virtio-9p, which proved to be more stable than virtio-fs in testing.
Building a statically linked QEMU is non-trivial on NixOS, nor is patching it to run on a FHS system without a Nix store. Therefore, we just take a pinned QEMU from the current Debian package for now.
This adds support for K3s/RKE2 deployment via the node-installer. It now, depending on its environment, replaces the configuration files for the embedded containerd on K3s and RKE2 and restarts the respective units.
The version of the runtime-class-files is now inherited from the image version, and the debug attribute in the node-installer image is now inherited from the runtime-class-files.
This renames the "flavours" package to the more descriptive "platforms".
This uses OVMF code and variables from nixpkgs, allowing us to not rely on the QEMU-supplied firmware.
@msanft msanft force-pushed the msanft/kata-qemu-tdx-runtime branch from f149b22 to 1e7b15d Compare June 26, 2024 12:57
@katexochen katexochen marked this pull request as draft July 1, 2024 11:03
@msanft msanft closed this Jul 4, 2024
@msanft msanft deleted the msanft/kata-qemu-tdx-runtime branch December 9, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants