Commit Graph

9056 Commits

Author SHA1 Message Date
Fabiano Fidêncio
df486533fa packaging: Allow building a CC shim-v2 capable runtime
Let's add a new build target for our local-build scripts, cc-shim-v2,
and use it to build Kata Containers properly configured for the CC
use-case.

Fixes: #4564
Depends-on: github.com/kata-containers/tests#4895

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-30 13:21:21 +02:00
Fabiano Fidêncio
7ceeeba9a2 static-build: Allow removing shipped shim-v2 configs
Let's add a new "REMOVE_VMM_CONFIGS" environment variable that can be
passsed to the script responsible for building Kata Containers.

Right now this is not useful for the `main` or `stable` branch, but for
the CC release we only have been working and testing with QEMU and Cloud
Hypervisor.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-30 13:06:43 +02:00
Fabiano Fidêncio
d4d178359b runtime: Expose DEFSERVICEOFFLOAD build option
For the CC build we need to enable such a flag, and the cleaner way to
do so is exposing it in the Makefile and, later on, making sure its
correct value to the build script.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-30 12:21:10 +02:00
Fabiano Fidêncio
e23322b95c packaging: Allow passing EXTRA_OPTS to the shim-v2 build
While this has never been needed for the `main` and `stable` releases,
for the coming CC release we need to pass a few extra options when
building the shim.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-30 12:16:44 +02:00
GabyCT
3a655c4198
Merge pull request #4558 from fidencio/topic/cc-build-rootfs-image-with-the-needed-tools
CC | Build the rootfs image with skopeo, umoci, and using an offline_fs_kbc
2022-06-29 17:05:55 -05:00
GabyCT
995c14d429
Merge pull request #4552 from fidencio/topic/cc-always-use-ubuntu-as-rootfs
CC | versions: Always use ubuntu as rootfs for CC
2022-06-29 17:04:11 -05:00
Fabiano Fidêncio
a438d6114b packaging: Allow building a CC capable image
Let's add a new build target for our local-build scripts,
cc-rootfs-image-tarball, and use it to build an image that has skopeo
and umoci embedded in, and that using the offline_fs_kbc as the
attenstation agent KBC.

Fixes: #4557

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-29 21:09:33 +02:00
Fabiano Fidêncio
335ddd5876 packaging: Do not unset env vars needed for CC
SKOPEO, UMOCI, and AA_KBC have been unset so far as we have not been
generating rootfs images that would be used for CC as part of our
workflow.

Now, as we're targetting the first release of the operator with the CCv0
branch, let's stop unsetting those and start taking advantage of our
tools to help us building a CC capable image.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-29 19:05:11 +02:00
Georgina Kinge
6c2b9f67d7
Merge pull request #4556 from GeorginaKin/CCv0
CCv0: Merge main into CCv0 branch
2022-06-29 15:59:56 +01:00
Georgina Kinge
eb9836ff8e runtime: add image import back in
Putting image import back in after removal during merge conflict

Fixes: #4555
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-06-29 14:13:18 +01:00
Georgina Kinge
bda68b16f1 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #4555
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-06-29 13:22:22 +01:00
Fabiano Fidêncio
03170c2651 versions: Always use ubuntu as rootfs for CC
As we're still depending on components that are only being tested on
Ubuntu, let's make sure the VM image distributed is exactly the same
we've been testing.

Fixes: #4551

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-29 11:25:23 +02:00
Fabiano Fidêncio
38b61bb743
Merge pull request #4537 from GeorginaKin/CCv0
CCv0: Refactor ccv0.sh to remove duplicate code
2022-06-29 08:17:35 +02:00
Fabiano Fidêncio
ad055235a5
Merge pull request #4547 from GabyCT/topic/removeunuseddocker
packaging: Remove unused kata docker configure script
2022-06-28 20:09:15 +02:00
GabyCT
b2c0387993
Merge pull request #4130 from surajssd/add-cgroup-driver-info
kata-with-k8s: Add cgroupDriver for containerd
2022-06-28 10:30:18 -05:00
Gabriela Cervantes
1a78c3df2e packaging: Remove unused kata docker configure script
This PR removes an unused kata configure docker script which was used
in packaging for kata 1.x but not longer being used in kata 2.x

Fixes #4546

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-06-28 15:10:39 +00:00
Georgina Kinge
74a748f36e CCv0: Refactor ccv0.sh to remove duplicate code
Refactored ccv0.sh to remove rootfs code now in lib.sh

Fixes: #4512

Co-authored-by: Megan Wright Megan.Wright@ibm.com
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-06-28 14:09:23 +01:00
Tim Zhang
916ffb75d7
Merge pull request #4432 from liubin/fix/4420-binary-log
shim: support shim v2 logging plugin
2022-06-28 16:29:07 +08:00
Bin Liu
4e30e11b31 shim: support shim v2 logging plugin
Now kata shim only supports stdout/stderr of fifo from
containerd/CRI-O, but shim v2 supports logging plugins,
and nerdctl default will use the binary schema for logs.

This commit will add the others type of log plugins:

- file
- binary

In case of binary, kata shim will receive a stdout/stderr like:

binary:///nerdctl?_NERDCTL_INTERNAL_LOGGING=/var/lib/nerdctl/1935db59

That means the nerdctl process will handle the logs(stdout/stderr)

Fixes: #4420

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-06-28 13:54:22 +08:00
Steve Horsman
c6a5814a91
Merge pull request #4490 from Megan-Wright/CCv0-containerd-1.6.6-rebase
CCv0: Update CC containerd version
2022-06-27 15:59:09 +01:00
stevenhorsman
761786324e CCv0: Increase timeout
Increase crictl timout to stop pod creation failing on v1.24.1

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-06-27 10:19:05 +01:00
Megan Wright
d6924182f3 vendor: Update CC containerd version
Re-vendor to pickup confidential-containers containerd 1.6.6 rebase
Fixes: #4489

Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-06-27 10:19:05 +01:00
Megan Wright
94a6edcfa3 versions: Update containerd version
Update kata-containers version to reflect 1.6.6 rebase of
containerd
Fixes: #4489

Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-06-27 10:14:32 +01:00
Fabiano Fidêncio
e52d6b1d0b
Merge pull request #4529 from GeorginaKin/CCv0
CCv0: Refactor ccv0.sh to use bats test
2022-06-27 09:39:27 +02:00
Bin Liu
27b1bb5ed9
Merge pull request #4467 from egernst/device-pkg
device package cleanup/refactor
2022-06-27 14:40:53 +08:00
Fabiano Fidêncio
54f47cceaa
Merge pull request #4518 from fidencio/topic/pin-a-specific-version-of-image-rs
CCv0 | agent: Pin a specific version of image-rs
2022-06-27 07:51:44 +02:00
Eric Ernst
e32bf53318 device: deduplicate state structures
Before, we maintained almost identical structures between our persist
API and what we keep for our devices, with the persist API being a
slight subset of device structures.

Let's deduplicate this, now that persist is importing device package.
Json unmarshal of prior persist structure will work fine, since it was
an exact subset of fields.

Fixes: #4468

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-06-26 21:31:29 -07:00
Eric Ernst
f97d9b45c8 runtime: device/persist: drop persist dependency from device pkgs
Rather than have device package depend on persist, let's define the
(almost duplicate) structures within device itself, and have the Kata
Container's persist pkg import these.

This'll help avoid unecessary dependencies within our core packages.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-06-26 21:31:29 -07:00
Eric Ernst
f9e96c6506 runtime: device: move to top level package
Let's move device package to runtime/pkg instead of being buried under
virtcontainers.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-06-26 21:31:29 -07:00
Bin Liu
3880e0c077 agent: refactor reading file timing for debugging
In the original code, reads mountstats file and return
the content in the error, but at this time the file maybe
changed, we should return the file content that parsed
line by line to check why there is not a fstype option.

Fixes: #4246

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-06-26 21:27:43 -07:00
Steve Horsman
ebacd986bb
Merge pull request #4532 from stevenhorsman/CCv0-PS1-unbound
CCv0: Fix PS1 unbound error
2022-06-25 18:08:24 +01:00
Archana Shinde
2488a0f6c0
Merge pull request #4439 from amshinde/update-kernel-to-5.15.46
versions: Update kernel to latest LTS version 5.15.48
2022-06-24 11:03:32 -07:00
stevenhorsman
305532db02 CCv0: Fix PS1 unbound error
export PS1, so it is bound

Fixes: #4531
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-06-24 17:27:43 +01:00
Georgina Kinge
20ef9e9f5c CCv0: Refactor ccv0.sh to use bats test
Refactored ccv0.sh to utilise new automated tests for pulling encrypted images and creating a pod.

Fixes: #4512
Depends-on: github.com/kata-containers/tests#4866

Co-authored-by: Megan Wright <Megan.Wright@ibm.com>
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-06-24 15:43:15 +01:00
Fabiano Fidêncio
083ca5f217
Merge pull request #4505 from yoheiueda/agent-debug-build
agent: Allow BUILD_TYPE=debug
2022-06-24 14:04:23 +02:00
Fabiano Fidêncio
03fca8b459
Merge pull request #4526 from fidencio/topic/fix-clippy-warnings-and-update-agent-vendored-code
Fix clippy warnings and update agent's vendored code
2022-06-24 14:02:28 +02:00
Fabiano Fidêncio
40b1c79c97 agent: Pin a specific version of image-rs
Let's pin a specific version of image-rs, one that pins a specific
version of ocicrypt-rs on their side, and ensure we don't fall into
issues by consuming the content from main on those repos, and also
helping to ensure reproducible builds from our side.

Fixes: #4517

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 14:01:53 +02:00
Fabiano Fidêncio
62864b5041 agent: Update Cargo.lock
Let's update the Cargo.lock file to bring in all the new dependencies
and to decrease the diff after pinning a specific version of image-rs.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 14:01:09 +02:00
Fabiano Fidêncio
404515f568 image_rpc: Fix "single-char-pattern" clippy warning
```
error: single-character string constant used as pattern
   --> src/image_rpc.rs:199:36
    |
199 |                 cid = v[0].replace(":", "_");
    |                                    ^^^ help: try using a `char` instead: `':'`
    |
    = note: `-D clippy::single-char-pattern` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern
```

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 14:00:17 +02:00
Fabiano Fidêncio
d21c3c340d random: Fix "nonminimal-bool" clippy warning
The error shown below was caught during a dependency bump in the CCv0
branch, but we better fix it here first.
```
error: this boolean expression can be simplified
  --> src/random.rs:85:21
   |
85 |             assert!(!ret.is_ok());
   |                     ^^^^^^^^^^^^ help: try: `ret.is_err()`
   |
   = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool

error: this boolean expression can be simplified
  --> src/random.rs:93:17
   |
93 |         assert!(!ret.is_ok());
   |                 ^^^^^^^^^^^^ help: try: `ret.is_err()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
```

Fixes: #4523

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 13:50:13 +02:00
Fabiano Fidêncio
386af028be netlink: Fix "or-fun-call" clippy warnings
The error shown below was caught during a dependency bump in the CCv0
branch, but we better fix it here first.
```
error: use of `ok_or` followed by a function call
   --> src/netlink.rs:526:14
    |
526 |             .ok_or(anyhow!(nix::Error::EINVAL))?;
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `ok_or_else(|| anyhow!(nix::Error::EINVAL))`
    |
    = note: `-D clippy::or-fun-call` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
error: use of `ok_or` followed by a function call
   --> src/netlink.rs:615:49
    |
615 |         let v = u8::from_str_radix(split.next().ok_or(anyhow!(nix::Error::EINVAL))?, 16)?;
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `ok_or_else(|| anyhow!(nix::Error::EINVAL))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
```

Fixes: #4523

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 13:50:13 +02:00
Fabiano Fidêncio
c70d3a2c35 agent: Update the dependencies
Let's run a `cargo update` and ensure the deps are up-to-date before we
cut the "-rc0" release.

Fixes: #4525

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 11:37:25 +02:00
Fabiano Fidêncio
612fd79bae random: Fix "nonminimal-bool" clippy warning
The error shown below was caught during a dependency bump in the CCv0
branch, but we better fix it here first.
```
error: this boolean expression can be simplified
  --> src/random.rs:85:21
   |
85 |             assert!(!ret.is_ok());
   |                     ^^^^^^^^^^^^ help: try: `ret.is_err()`
   |
   = note: `-D clippy::nonminimal-bool` implied by `-D warnings`
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool

error: this boolean expression can be simplified
  --> src/random.rs:93:17
   |
93 |         assert!(!ret.is_ok());
   |                 ^^^^^^^^^^^^ help: try: `ret.is_err()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
```

Fixes: #4523

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 11:37:05 +02:00
Fabiano Fidêncio
d4417f210e netlink: Fix "or-fun-call" clippy warnings
The error shown below was caught during a dependency bump in the CCv0
branch, but we better fix it here first.
```
error: use of `ok_or` followed by a function call
   --> src/netlink.rs:526:14
    |
526 |             .ok_or(anyhow!(nix::Error::EINVAL))?;
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `ok_or_else(|| anyhow!(nix::Error::EINVAL))`
    |
    = note: `-D clippy::or-fun-call` implied by `-D warnings`
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
error: use of `ok_or` followed by a function call
   --> src/netlink.rs:615:49
    |
615 |         let v = u8::from_str_radix(split.next().ok_or(anyhow!(nix::Error::EINVAL))?, 16)?;
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `ok_or_else(|| anyhow!(nix::Error::EINVAL))`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
```

Fixes: #4523

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-06-24 11:37:01 +02:00
Steve Horsman
0782f4a43b
Merge pull request #4514 from stevenhorsman/CCv0-update-crictl-pod-config
doc: Update crictl pod-config
2022-06-24 08:38:39 +01:00
Archana Shinde
93874cb3bb packaging: Restrict kernel patches applied to top-level dir
The apply_patches.sh script applies all patches in the patches
directory,  as well as subdirectories. This means if there is a sub-dir
called "experimental" under a major kernel version directory,
experimental patches would be applied to the default kernel supported by
Kata.
We did not come accross this issue earlier as typically the experimental
kernel version was different from the default kernel.
With both the default kernel and the arm-experimental kernel having the
same major kernel version (5.15.x) at this time, trying to update the
kernel patch version revealed that arm-experimental patches were being
applied to the default kernel.

Restricting the patches to be applied to the top level directory will
solve the issue. The apply_patches script should ignore any
sub-directories meant for experimental patches.

Fixes #4520

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2022-06-23 10:43:52 -07:00
Archana Shinde
07b1367c2b versions: Update kernel to latest LTS version 5.15.48
This brings in a few security fixes.
Removing arm patches related to virtio-mem that are no longer required
as they have been merged.

Fixes #4438

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2022-06-23 10:43:52 -07:00
Fabiano Fidêncio
133528dd14
Merge pull request #4503 from amshinde/multi-queue-block
block: Leverage multiqueue for virtio-block
2022-06-23 12:17:11 +02:00
Fabiano Fidêncio
f186a52b16
Merge pull request #4511 from fidencio/topic/add-config-efi-to-the-tdx-kernel
kernel: Add CONFIG_EFI=y as part of the TDX fragments
2022-06-23 12:15:30 +02:00
Yohei Ueda
1b7d36fdb0
agent: Allow BUILD_TYPE=debug
The cargo command creates debug build binaries, when the --release
option is not specified. Specifying --debug option causes an error.
This patch specifies --release option when BUILD_TYPE=release,
and does not specify any build type option when BUILD_TYPE=debug.

Fixes #4504

Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2022-06-23 13:54:32 +09:00