Commit Graph

14598 Commits

Author SHA1 Message Date
Aurélien Bombo
79a3b4e2e5
Merge pull request #10335 from kata-containers/sprt/fix-kata-deploy-docs
kata-deploy: clean up and fix docs for k0s
2024-09-20 13:33:14 -07:00
Aurélien Bombo
78c63c7951 kata-deploy: clean up and fix docs for k0s
* Clarifies instructions for k0s.
* Adds kata-deploy step for each cluster type.
* Removes the old kata-deploy-stable step for vanilla k8s.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2024-09-20 11:59:40 -05:00
Fabiano Fidêncio
77c844da12
Merge pull request #10239 from fidencio/topic/remove-acrn
acrn: Drop support
2024-09-19 23:10:29 +02:00
GabyCT
6eef58dc3e
Merge pull request #10336 from GabyCT/topic/extendtimeout
gha: Increase timeout to run k8s tests on TDX
2024-09-19 13:12:55 -06:00
Fabiano Fidêncio
51dade3382 docs: Fix spell checker
tokio is not a valid word, it seeems, so let's use `tokio`.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-09-19 20:25:21 +02:00
Gabriela Cervantes
49b3a0faa3 gha: Increase timeout to run k8s tests on TDX
This PR increases the timeout to run k8s tests for Kata CoCo TDX
to avoid the random failures of timeout.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-09-19 17:15:47 +00:00
Fabiano Fidêncio
31438dba79 docs: Fix qemu link
Otherwise static checks will fail, as we woke up the dogs with changes
on the same file.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-09-19 16:05:43 +02:00
Fabiano Fidêncio
fefcf7cfa4 acrn: Drop support
As we don't have any CI, nor maintainer to keep ACRN code around, we
better have it removed than give users the expectation that it should or
would work at some point.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-09-19 16:05:43 +02:00
Fabiano Fidêncio
cdaaf708a1
Merge pull request #10334 from emanuellima1/bump-version
release: Bump version to 3.9.0
2024-09-19 15:27:50 +02:00
Emanuel Lima
a6ee15c5c7
release: Bump VERSION to 3.9.0
Starting the v3.9.0 release

Signed-off-by: Emanuel Lima <emlima@redhat.com>
2024-09-19 10:14:55 -03:00
Fabiano Fidêncio
e9593b53a4
Merge pull request #10234 from pmores/add-support-for-disabled-guest-selinux
runtime-rs: add support for disabled guest selinux
2024-09-19 15:03:24 +02:00
Fabiano Fidêncio
4d11fecc2d
Merge pull request #10274 from ajaypvictor/remote_image-os_types
runtime: Enable Image annotation for remote hypervisor
2024-09-19 13:39:20 +02:00
Fabiano Fidêncio
3d5f48e02e
Merge pull request #10283 from alexman-stripe/alexman-stripe/fix-kata-shim-not-reporting-inactive-file-cgroup-v2
shim: Fix memory usage reporting for cgroup v2
2024-09-19 12:50:36 +02:00
Pavel Mores
5e5eb9759f runtime-rs: handle disabled guest selinux in virtiofsd
This is just a port of functionality existing in the golang runtime.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-09-19 12:47:10 +02:00
Pavel Mores
8c92f3bfec runtime-rs: enable/disable selinux in guest based on disable_guest_selinux
This change technically affects the path for enabled guest selinux as well,
however since this is not implemented in runtime-rs anyway nothing should
break.  When guest selinux support is added this change will come handy.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-09-19 12:47:10 +02:00
Pavel Mores
204ee21bc8 runtime-rs: handle disabled guest selinux in OCI spec
If guest selinux is off the runtime has to ensure that container OCI spec
contains no selinux labels for the container rootfs and process.  Failure
to do so causes kata agent to try and apply the labels which fails since
selinux is not enabled in guest, which in turn causes container launch
to fail.

This is largely inspired by golang runtime(*) with a slight deviation
in ordering of checks.  This change simply checks the disable_guest_selinux
config setting and if it's true it clears both rootfs and process label if
necessary.  Golang runtime, on the other hand, seems to first check if
process label is non-empty and only then it checks the config setting,
meaning that if process label is empty the rootfs label is not reset
even if it's non-empty.  Frankly, this looks like a potential bug though
probably unlikely to manifest since it can be assumed that the labels are
either both empty, or both non-empty.

(*) 4fd4b02f2e/src/runtime/virtcontainers/kata_agent.go (L1005)

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-09-19 12:47:10 +02:00
Pavel Mores
eb1227f47d runtime-rs: parse the disable_guest_selinux config key
In order to handle the setting we have to first parse it and make its
value available to the rest of the program.

The yes() function is added to comply with serde which seems to insist
on default values being returned from functions.  Long term, this is
surely not the best place for this function to live, however given that
this is currently the first and only place where it's used it seems
appropriate to put it near its use.  If it ends up being reused elsewhere
a better place will surely emerge.

Signed-off-by: Pavel Mores <pmores@redhat.com>
2024-09-19 12:47:10 +02:00
Steve Horsman
8789551fe6
Merge pull request #10333 from fidencio/topic/ci-bump-ubuntu-20.04-runners-to-22.04
ci: Bump ubuntu 20.04 runners to 22.04
2024-09-19 11:44:33 +01:00
Fabiano Fidêncio
35c7f8d1ba ci: Bump ubuntu 20.04 runners to 22.04
Azure internal mirrors for Ubuntu 20.04 have gone awry, leading to a
situation where dependencies cannot be installed (such as
libdevmapper-dev), blocking then our CI.

Let's bump the runners to 22.04 regardless, even knowing it'll cause an
issue with the runk tests, as the agent check tests are considered more
crucial to the project at this point.

Signed-off-by: Fabiano Fidêncio <fabiano@fidencio.org>
2024-09-19 12:29:20 +02:00
Fabiano Fidêncio
eccdffebf7
Merge pull request #10243 from katexochen/nydus-overlayfs-path
virtcontainers: allow specifying nydus-overlayfs binary by path
2024-09-19 11:35:45 +02:00
Ajay Victor
a19f2eacec runtime: Enable ImageName annotation for remote hypervisor
Enables ImageName to support multiple VM images in remote hypervisor scenario

Fixes https://github.com/kata-containers/kata-containers/issues/10240

Signed-off-by: Ajay Victor <ajvictor@in.ibm.com>
2024-09-19 14:48:46 +05:30
Alex Man
27f8f69195 shim: Fix memory usage reporting for cgroup v2
kata-shim was not reporting `inactive_file` in memory stat.

This memory is deducted by containerd when calculating the size of container working set, as it can be paged out by the operating
system under memory pressure. Without reporting `inactive_file`, containerd will over report container memory usage.
[Here](https://github.com/containerd/containerd/blob/v1.7.22/pkg/cri/server/container_stats_list_linux.go#L117) is where containerd
deducts `inactive_file` from memory usage.

Note that kata-shim correctly reports `total_inactive_file` for cgroup v1, but this was not implemented for cgroup v2.

This commit:
- Adds code in kata-shim to report "inactive_file" memory for cgroup v2
- Implements reporting of all available cgroup v2 memory stats to containerd
- Uses defensive coding to avoid assuming existence of any memory.stat fields

The list of available cgroup v2 memory stats defined by containerd can be found
[here](https://pkg.go.dev/github.com/containerd/cgroups/v2/stats#MemoryStat).

Fixes #10280

Signed-off-by: Alex Man <alexman@stripe.com>
2024-09-18 14:04:24 -07:00
Fabiano Fidêncio
1597f8ba00
Merge pull request #10279 from alexman-stripe/alexman-stripe/fix-cgroup-v2-wrong-cpu-usage-unit
agent: Fix CPU usage reporting for cgroup v2 in kata-agent
2024-09-18 21:36:52 +02:00
Fabiano Fidêncio
593cbb8710
Merge pull request #10306 from microsoft/danmihai1/more-security-contexts
genpolicy: get UID from PodSecurityContext
2024-09-18 21:33:39 +02:00
Aurélien Bombo
5402f2c637
Merge pull request #10308 from Sumynwa/sumsharma/add_setpolicy_agent_ctl
agent-ctl: Add SetPolicy support
2024-09-18 10:09:07 -07:00
Sumedh Alok Sharma
18c887f055 agent-ctl: Add SetPolicy support
This patch adds support to call kata agents SetPolicy
API. Also adds tests for SetPolicy API using agent-ctl.

Fixes #9711

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2024-09-18 10:53:49 +05:30
GabyCT
28d430ec42
Merge pull request #10324 from GabyCT/topic/fixinlib
ci: Fix indentation of install libseccomp script
2024-09-17 14:21:24 -06:00
Fabiano Fidêncio
da2377346d
Merge pull request #10323 from stevenhorsman/update-kubectl-release-url
kata-deploy: Switch Kubernetes URL
2024-09-17 20:47:17 +02:00
Gabriela Cervantes
096f32cc52 ci: Fix indentation of install libseccomp script
This PR fixes the indentation of the install libseccomp script.

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2024-09-17 16:38:53 +00:00
Aurélien Bombo
9d29ce460d
Merge pull request #10303 from Sumynwa/sumsharma/agent_policy_set_env
agent: add support to provide default agent policy via env
2024-09-17 09:04:11 -07:00
stevenhorsman
c0d35a66aa ci: kata-deploy: Update kubectil install URL
The `deploy_k0s` and `deploy_k3s` kubectl installs aren't failing
yet, but let get ahead of this and bump them as well

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2024-09-17 15:35:42 +01:00
stevenhorsman
1abeffdac6 kata-deploy: Switch Kubernetes URL
The payload build is failing with:
```
ERROR: failed to solve: process "/bin/sh -c apk --no-cache add bash curl &&
ARCH=$(uname -m) &&
if [ \"${ARCH}\" = \"x86_64\" ]; then ARCH=amd64; fi &&
if [ \"${ARCH}\" = \"aarch64\" ]; then ARCH=arm64; fi &&
DEBIAN_ARCH=${ARCH} &&
if [ \"${DEBIAN_ARCH}\" = \"ppc64le\" ]; then DEBIAN_ARCH=ppc64el; fi &&
curl -fL --progress-bar -o /usr/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/ \
$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/${ARCH}/kubectl &&
chmod +x /usr/bin/kubectl &&
curl -fL --progress-bar -o /usr/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-${DEBIAN_ARCH} &&
chmod +x /usr/bin/jq &&
mkdir -p ${DESTINATION} &&
tar xvf ${WORKDIR}/${KATA_ARTIFACTS} -C ${DESTINATION} &&
rm -f ${WORKDIR}/${KATA_ARTIFACTS} &&
apk del curl &&
apk --no-cache add py3-pip &&
pip install --no-cache-dir yq==3.2.3" did not complete successfully: exit code: 22
```

Looking into this, the problem is that
https://storage.googleapis.com/kubernetes-release/release/v1.31.1/bin/linux/amd64/kubectl
doesn't exist. The [kubectl install doc](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-kubectl-on-linux)
recommends the `dl.k8s.io` site, so let's switch to this.

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2024-09-17 15:35:42 +01:00
Steve Horsman
5448f7fbbf
Merge pull request #10321 from BbolroC/fix-build-boot-image-se
local-build: Fix unbound variable issue for lib_se.sh
2024-09-17 15:35:04 +01:00
Hyounggyu Choi
72471d1a18 local-build: Fix unbound variable for lib_se.sh
As #10315 introduced an `unbound variable` error, this is a
hot-fix for it.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-09-17 10:01:14 +02:00
Hyounggyu Choi
72df3004e8 gha: Rebase build-secure-image-se atop of latest target branch
This commit adds a step called `Rebase atop of the latest target branch`
to the job named `build-asset-boot-image-se` which can test the PR properly.

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-09-17 09:54:51 +02:00
Hyounggyu Choi
03cd02a006
Merge pull request #10315 from BbolroC/update-ibm-se-doc
doc: Update how-to-run-kata-containers-with-SE-VMs.md
2024-09-16 15:12:18 +02:00
Sumedh Alok Sharma
cefba08903 agent: add support to provide default agent policy via env
agent built with policy feature initializes the policy engine using a
policy document from a default path, which is installed & linked during
UVM rootfs build. This commit adds support to provide a default agent
policy as environment variable.

This targets development/testing scenarios where kata-agent
is wanted to be started as a local process.

Fixes #10301

Signed-off-by: Sumedh Alok Sharma <sumsharma@microsoft.com>
2024-09-16 18:05:21 +05:30
Hyounggyu Choi
8d609e47fb doc: Update how-to-run-kata-containers-with-SE-VMs.md
The following changes have been made:

- Remove unnecessary `sudo`
- Add an error message where an incorrect host key document is used
- Add a missing artifact `kernel-confidential-modules`
- Make a variable `kernel_version` and replace it with relevant hits

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2024-09-16 12:53:30 +02:00
Fabiano Fidêncio
fc5a631791
Merge pull request #10009 from Xynnn007/feat-cosign
Merge to main: supporting pull cosign signed images
2024-09-16 12:08:26 +02:00
stevenhorsman
aa9f21bd19 test: Add support for s390x in cosign testing
We've added s390x test container image, so add support
to use them based on the arch the test is running on

Fixes: #10302

Signed-off-by: stevenhorsman <steven@uk.ibm.com>

fixuop
2024-09-16 09:20:57 +01:00
stevenhorsman
3087ce17a6 tests: combined pod yaml creation for CoCo tests
This commit brings some public parts of image pulling test series like
encrypted image pulling, pulling images from authenticated registry and
image verification. This would help to reduce the cost of maintainance.

Co-authored-by: stevenhorsman <steven@uk.ibm.com>
Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2024-09-16 09:20:57 +01:00
Xynnn007
c80c8d84c3 test: add cosign signature verificaton tests
Close #8120

**Case 1**
Create a pod from an unsigned image, on an insecureAcceptAnything
registry works.

Image: quay.io/prometheus/busybox:latest
Policy rule:
```
"default": [
    {
        "type": "insecureAcceptAnything"
    }
]
```

**Case 2**
Create a pod from an unsigned image, on a 'restricted registry' is
rejected.

Image: ghcr.io/confidential-containers/test-container-image-rs:unsigned
Policy rule:
```
"quay.io/confidential-containers/test-container-image-rs": [
    {
        "type": "sigstoreSigned",
        "keyPath": "kbs:///default/cosign-public-key/test"
    }
]
```

**Case 3**
Create a pod from a signed image, on a 'restricted registry' is
successful.

Image: ghcr.io/confidential-containers/test-container-image-rs:cosign-signed
Policy rule:
```
"ghcr.io/confidential-containers/test-container-image-rs": [
    {
        "type": "sigstoreSigned",
        "keyPath": "kbs:///default/cosign-public-key/test"
    }
]
```

**Case 4**
Create a pod from a signed image, on a 'restricted registry', but with
the wrong key is rejected

Image:
ghcr.io/confidential-containers/test-container-image-rs:cosign-signed-key2

Policy:
```
"ghcr.io/confidential-containers/test-container-image-rs": [
    {
        "type": "sigstoreSigned",
        "keyPath": "kbs:///default/cosign-public-key/test"
    }
]
```

**Case 5**
Create a pod from an unsigned image, on a 'restricted registry' works
if enable_signature_verfication is false

Image: ghcr.io/kata-containers/confidential-containers:unsigned

image security enable: false

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2024-09-16 09:20:57 +01:00
Xynnn007
9606e7ac8b agent: Set image-rs image security policy
Add two parameters for enabling cosign signature image verification.
- `enable_signature_verification`: to activate signature verification
- `image_policy`: URI of the image policy
config

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2024-09-16 09:20:57 +01:00
Xynnn007
653bc3973f agent: fix make test for kata-agent of dependency anyhow
new version of the anyhow crate has changed the backtrace capture thus
unit tests of kata-agent that compares a raised error with an expected
one would fail. To fix this, we need only panics to have backtraces,
thus set `RUST_BACKTRACE=1` and `RUST_LIB_BACKTRACE=0` for tests due to
document

https://docs.rs/anyhow/latest/anyhow/

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2024-09-16 09:20:57 +01:00
Fabiano Fidêncio
dfcb41b5cc
Merge pull request #10313 from stevenhorsman/coco-components-0.10-bump
CoCo: Bump Coco components to 0.10 releases
2024-09-14 21:43:28 +02:00
stevenhorsman
705e469696
rootf: Change initrd alpine mirror
The rootfs-initrd build is failing with:
```
fetch https://mirror.math.princeton.edu/pub/alpinelinux//v3.18/main/aarch64/APKINDEX.tar.gz
6684368:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:ssl/statem/statem_clnt.c:1914:
ERROR: https://mirror.math.princeton.edu/pub/alpinelinux//v3.18/main: Permission denied
```
so try bumping to a newer version of alpine to see
if that helps the issue

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2024-09-14 18:47:45 +02:00
Dan Mihai
5777869cf4 tests: k8s-policy-rc: add unexpected UID test
Change pod runAsUser value of a Replication Controller after generating
the RC's policy, and verify that the RC pods get rejected due to this
change.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-09-13 22:05:31 +00:00
Dan Mihai
6773f14667 tests: k8s-policy-job: add unexpected UID test
Change pod runAsUser value of a Job after generating the Job's policy,
and verify that the Job gets rejected due to this change.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-09-13 22:05:31 +00:00
Dan Mihai
124f01beb3 tests: k8s-policy-deployment: add bad UID test
Change pod runAsUser value of a Deployment after generating the
Deployment's policy, and verify that the Deployment fails due to
this change.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-09-13 22:05:31 +00:00
Dan Mihai
16f5ebf5f9 genpolicy: get UID from PodSecurityContext
Get UID from PodSecurityContext for other k8s resource types too,
not just for Pods.

Signed-off-by: Dan Mihai <dmihai@microsoft.com>
2024-09-13 22:05:31 +00:00