Commit Graph

7388 Commits

Author SHA1 Message Date
Peng Tao
917915650c
Merge pull request #3893 from fengwang666/my_2.3_pr_backport
runtime: Properly handle ESRCH error when signaling container
2022-03-15 14:10:49 +08:00
GabyCT
7a5e34c2e6
Merge pull request #3890 from likebreath/stable-2.3
stable-2.3 | versions: Upgrade to Cloud Hypervisor v22.1
2022-03-14 17:44:29 -06:00
Feng Wang
2e86db78cf runtime: Properly handle ESRCH error when signaling container
Currently kata shim v2 doesn't translate ESRCH signal, causing container
fail to stop and shim leak.

Fixes: #3874

Signed-off-by: Feng Wang <feng.wang@databricks.com>
(cherry picked from commit aa5ae6b17c)
2022-03-14 13:20:23 -07:00
Bo Chen
6138e3b65a versions: Upgrade to Cloud Hypervisor v22.1
This is a bug fix release. The following issues have been addressed:
1) VFIO ioctl reordering to fix MSI on AMD platforms; 2) Fix virtio-net
control queue.

Details can be found: https://github.com/cloud-hypervisor/cloud-hypervisor/releases/tag/v22.1

Note: client code of Cloud Hypervisor is not updated given this is a
backport change.

Fixes: #3872

Signed-off-by: Bo Chen <chen.bo@intel.com>
(cherry picked from commit 7a18e32fa7)
2022-03-14 12:31:14 -07:00
Fabiano Fidêncio
a2c228ef66
Merge pull request #3824 from fidencio/stable-2.3-clh-stop-virtiofsd-if-clh-fails-to-boot-up-the-vm
stable-2.3 | clh: stop virtofsd if clh fails to boot up the vm
2022-03-03 23:25:45 +01:00
Fabiano Fidêncio
b2a7eea4a7 clh: stop virtofsd if clh fails to boot up the vm
If, for some reason, we're able to launch cloud hypervisor but not able
to boot the VM up, the virtiofsd process would be left behind.

Let's ensure, via defer, that we stop virtiofsd in case of errors.

Fixes: #3819
Backports: #3823

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-03 19:23:22 +01:00
Eric Ernst
97cd593953
Merge pull request #3798 from egernst/2.3.3-branch-bump
# Kata Containers 2.3.3
2022-03-01 10:18:27 -08:00
Eric Ernst
652cff16b4 release: Kata Containers 2.3.3
- back port:: runtime: make selinux configurable
- stable-2.3 | kata-deploy: Use (kata with) qemu as the default shim-v2 binary
- stable-2.3 | shim: log events for CRI-O
- stable-2.3 | agent: fix invalid hooks env issues
- stable-2.3 | packaging: Use `patch` for applying patches

0b6e9f83 runtime: make selinux configurable
408477a2 kata-deploy: Use (kata with) qemu as the default shim-v2 binary
9431498e shim: log events for CRI-O
406f00a3 packaging: Use `patch` for applying patches
7af719e4 agent: handle hook process result
9b34cf46 agent: valid envs for hooks
9c195364 agent: Fix execute_hook() args error
9bea3a42 agent: check environment variables if empty or invalid

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-03-01 08:38:59 -08:00
Fabiano Fidêncio
48732f5c4f
Merge pull request #3794 from egernst/backport-selinux-build
back port:: runtime: make selinux configurable
2022-03-01 08:54:23 +01:00
Tanweer Noor
0b6e9f8365 runtime: make selinux configurable
removes --tags selinux handling in the makefile (part of it introduced here: d78ffd6)
and makes selinux configurable via configuration.toml

Fixes: #3631
Signed-off-by: Tanweer Noor <tnoor@apple.com>
2022-02-28 20:58:46 -08:00
snir911
d2d579f1aa
Merge pull request #3745 from fidencio/stable-2.3-kata-deploy-use-kata-with-qemu-as-the-default-shim-v2-binary
stable-2.3 | kata-deploy: Use (kata with) qemu as the default shim-v2 binary
2022-02-22 14:29:39 +02:00
snir911
a373dc0270
Merge pull request #3744 from liubin/backport/3736
stable-2.3 | shim: log events for CRI-O
2022-02-22 12:30:16 +02:00
Fabiano Fidêncio
408477a263 kata-deploy: Use (kata with) qemu as the default shim-v2 binary
When using kata-deploy, no `containerd-shim-kata-v2` binary is deployed,
but we do deploy a `kata` runtime class, which seems very much
incosistent.

As the default configuration for kata-containers points to QEMU, let's
also use kata with QEMU as the default shim-v2 binary.

Fixes: #3228, #3734

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
(cherry picked from commit 11220f052f)
2022-02-22 09:57:04 +01:00
bin
9431498e14 shim: log events for CRI-O
CRI-O start shim process without setting TTRPC_ADDRESS,
that the forwarding events goroutine will get errors.

For CRI-O runtime, we can log the events to log file.

Fixes: #3733

Signed-off-by: bin <bin@hyper.sh>
2022-02-22 16:27:00 +08:00
Fabiano Fidêncio
41cc86751b
Merge pull request #3716 from liubin/backport/3668
stable-2.3 | agent: fix invalid hooks env issues
2022-02-19 08:39:23 +01:00
Fabiano Fidêncio
bf9b364678
Merge pull request #3725 from Jakob-Naucke/backport-fix-apply-patches
stable-2.3 | packaging: Use `patch` for applying patches
2022-02-19 08:38:55 +01:00
Jakob Naucke
406f00a3a2
packaging: Use patch for applying patches
`tools/packaging/scripts/apply_patches.sh` uses `git apply $patch`, but
this will not apply to subdirectories. If one wanted to apply with
`git apply`, they'd have to run it with `--directory=...`
_relative to the Git tree's root_ (absolute will not work!). I suggest
we just use `patch`, which will do what we expected `git apply` would
do.

`patch` is also added to build containers that require it.

Fixes: #3690
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-18 16:55:23 +01:00
bin
7af719e47c agent: handle hook process result
Current hook process is handled by just calling
unwrap() on it, sometime it will cause panic.

By handling all Result type and check the error can
avoid panic.

Fixes: #3649

Signed-off-by: bin <bin@hyper.sh>
2022-02-18 15:29:11 +08:00
bin
9b34cf46da agent: valid envs for hooks
Envs contain null-byte will cause running hooks to panic,
this commit will filter envs and only pass valid envs to hooks.

Fixes: #3667

Signed-off-by: bin <bin@hyper.sh>
2022-02-18 15:28:55 +08:00
Binbin Zhang
9c1953641b agent: Fix execute_hook() args error
1. The hook.args[0] is the hook binary name which shouldn't be included
in the Command.args.
2. Add new unit tests

Fixes: #2610

Signed-off-by: Binbin Zhang <binbin36520@gmail.com>
Signed-off-by: bin <bin@hyper.sh>
2022-02-18 15:28:50 +08:00
bin
9bea3a42a7 agent: check environment variables if empty or invalid
Invalid environment variable key/value will cause set_env panic.

Refer: https://doc.rust-lang.org/std/env/fn.set_var.html#panics

Fixes: #3006

Signed-off-by: bin <bin@hyper.sh>
2022-02-18 13:18:01 +08:00
Fabiano Fidêncio
1af292c9e6
Merge pull request #3585 from snir911/2.3.2-branch-bump
# Kata Containers 2.3.2
2022-02-03 08:05:22 +01:00
Snir Sheriber
67947b5f05 release: Kata Containers 2.3.2
- stable-2.3 | workflows: Use base instead of head ref for kata-deploy-test
- stable-2.3-backports
- [backport from main] agent: fix the issue of missing create a new session for container
- stable-2.3 - kata-deploy: validate conf file can be created
- stable-2.3 | kata-monitor: increase delay before syncing with the container manager
- stable-2.3 | versions: Upgrade to Cloud Hypervisor v21.0
- stable-2.3: backport lint fixes from main
- stable-2.3 | runtime: -Wl,--s390-pgste for s390x
- stable-2.3 | kata-manager: Retrieve static tarball
- stable-2.3 | ci: Pass function arguments in static-checks.sh

977f1f5b workflows: Use base instead of head ref for kata-deploy-test
99ed596a workflows: Fix typo in kata-deploy-push action
13b7d93b workflows: Ensure a label change re-triggers the actions
b8463224 workflows: Ensure force-skip-ci skips all actions
8c8571f4 workflows: Use the correct branch ref on test kata-deploy
620bb97e runtime: Provide protection for shared data
770d4acf tools: Fix groupname if it differs from username
cedb01d2 runtime: close span before return from function in case of error
a661e538 agent: fix the issue of missing create a new session for container
bed0f3c8 kata-deploy: validate conf file can be created
786c667e kata-monitor: increase delay before syncing with the container manager
e3b00f39 runtime: -Wl,--s390-pgste for s390x
3260adc4 virtcontainers: clh: Re-generate the client code
cc64461f versions: Upgrade to Cloud Hypervisor v21.0
f2c6cd08 ci: Pass function arguments in static-checks.sh
78afa10a agent: resolve unused variables in tests
a8298676 agent: remove unused field in mount handling
87f9a690 agent: drop unused fields from network
fc012a2b agent: clear cargo test warnings
63c5a8aa uevent: Fix clippy issue in test code
d1530afa kata-manager: Retrieve static tarball

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2022-02-01 20:02:37 +02:00
Fabiano Fidêncio
f2cbfad8b0
Merge pull request #3580 from fidencio/wip/stable-2.3-fix-kata-deploy-ref-branch
stable-2.3 | workflows: Use base instead of head ref for kata-deploy-test
2022-02-01 18:23:33 +01:00
Fabiano Fidêncio
977f1f5bb6 workflows: Use base instead of head ref for kata-deploy-test
Although I've done tests on my own fork using `head_ref` and those
worked, it seems those only worked as the PR was coming from exactly the
same repository as the target one.

Let's switch to base_ref, instead, which we for sure have as part of our
repo.

The downside of this is that we run the test with the last merged PR,
rather than with the "to-be-approved" PR, but that's a limitation we've
always had.

Fixes: #3482

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
(cherry picked from commit 3924470c8f)
2022-02-01 17:05:31 +01:00
Fabiano Fidêncio
e9aaefb135
Merge pull request #3575 from snir911/stable-2.3-backports232
stable-2.3-backports
2022-01-31 20:19:11 +01:00
Fabiano Fidêncio
99ed596ae4 workflows: Fix typo in kata-deploy-push action
A `:` was missed when d87ab14fa7 was
introduced.

Fixes: #3485

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-31 12:45:05 +02:00
Fabiano Fidêncio
13b7d93b4f workflows: Ensure a label change re-triggers the actions
This is needed in order to ensure that, for instance, if `force-skip-ci`
label is either added or removed later, the jobs related to the actions
will be restarted and accordingly checked.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-31 12:44:37 +02:00
Fabiano Fidêncio
b8463224c8 workflows: Ensure force-skip-ci skips all actions
Before this change it was only applied to the static-checks, but if
we're already taking the extreme path of skipping the CI, we better
ensure we skip all the actions and not just a few of them.

Fixes: #3471

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-31 12:44:33 +02:00
Fabiano Fidêncio
8c8571f4ba workflows: Use the correct branch ref on test kata-deploy
The action used for testing kata-deploy is entirely based on the action
used to build the kata-deploy tarball, but while the latter is able to
use the correct branch, the former always uses `main`.

This happens as the `issue_comment`, from GitHub actions, passed the
"default branch" as the GITHUB_REF.

As we're not the first ones to face such a issue, I've decided to take
one of the approaches suggested at one of the checkout's issues,
https://github.com/actions/checkout/issues/331, and take advantage of a
new action provided by the community, which will get the PR where the
comment was made, give us that ref, and that then can be used with the
checkout action, resulting on what we originally wanted.

Fixes: #3443

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-01-31 12:33:12 +02:00
liangxianlong
620bb97e3f runtime: Provide protection for shared data
The k.reqHandlers should be protected by locks when used

Fixes #3440

Signed-off-by: liangxianlong <liang.xianlong@zte.com.cn>
2022-01-31 12:32:55 +02:00
Sebastian Hasler
770d4acf8b tools: Fix groupname if it differs from username
The script `tools/packaging/static-build/qemu/build-base-qemu.sh`
previously failed on systems where the user's groupname differs from the
username

Fixes: #3461

Signed-off-by: Sebastian Hasler <sebastian.hasler@stuvus.uni-stuttgart.de>
2022-01-31 12:32:47 +02:00
bin
cedb01d295 runtime: close span before return from function in case of error
Return before closing span will cause invalid spans, so span should
be closed before function return.

Fixes: #3424

Signed-off-by: bin <bin@hyper.sh>
2022-01-31 12:32:14 +02:00
Peng Tao
1ccc95fba1
Merge pull request #3563 from lifupan/stable-2.3-backport-3063
[backport from main] agent: fix the issue of missing create a new session for container
2022-01-29 14:24:17 +08:00
Fupan Li
a661e53892 agent: fix the issue of missing create a new session for container
When the container didn't had a tty console, it would be in a same
process group with the kata-agent, which wasn't expected. Thus,
create a new session for the container process.

Fixes: #3063

Signed-off-by: Fupan Li <fupan.lfp@antgroup.com>
2022-01-28 09:44:04 +08:00
snir911
5475d7a7e9
Merge pull request #3561 from snir911/stable-2.3-backport-3433
stable-2.3 - kata-deploy: validate conf file can be created
2022-01-27 19:28:11 +02:00
Snir Sheriber
bed0f3c801 kata-deploy: validate conf file can be created
As containerd doesn't exist at cleanup

Fixes: #3429
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2022-01-27 17:08:48 +02:00
Peng Tao
04426d65ba
Merge pull request #3554 from fgiudici/stable-2.3_monitor_sync
stable-2.3 | kata-monitor: increase delay before syncing with the container manager
2022-01-27 16:49:37 +08:00
Fabiano Fidêncio
3e1955effd
Merge pull request #3535 from likebreath/0121/backport_clh_v21.0
stable-2.3 | versions: Upgrade to Cloud Hypervisor v21.0
2022-01-27 08:02:15 +01:00
Eric Ernst
52dd41dacb
Merge pull request #3532 from egernst/stable-backport-lints
stable-2.3: backport lint fixes from main
2022-01-25 16:37:32 -08:00
Francesco Giudici
786c667e60 kata-monitor: increase delay before syncing with the container manager
When we detect a new kata sandbox from the sbs fs, we add that to the
sandbox cache to retrieve metrics.
We also schedule a sync with the container manager, which we consider
the source of truth: if the kata pod is not yet ready the container
manager will not report it and we will drop it from our cache.
We will add it back only when we re-sync, i.e., when we get an event
from the sbs fs (which means a kata pod has been terminated or a new one
has been started).

Since we use the sync with the container manager to remove pods from the
cache, we can wait some more before syncing (and so reduce the chance to
miss a kata pod just because it was not ready yet).

Let's raise the waiting time before starting the sync timer.

Fixes: #3550

Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2022-01-25 18:18:10 +01:00
Jakob Naucke
cf5a79cfe1
Merge pull request #3528 from Jakob-Naucke/backport-pgste
stable-2.3 | runtime: -Wl,--s390-pgste for s390x
2022-01-24 15:00:44 +01:00
Jakob Naucke
e3b00f398b
runtime: -Wl,--s390-pgste for s390x
for linking. Required for basic KVM checks on some kernels (e.g. the
one RHEL is currently shipping), cf.
6621441db5/target/s390x/kvm/meson.build (L15-L16).

Must also be applied to netmon in backport.

Fixes: #3469
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
Co-authored-by: Amulya Meka <amulmek1@in.ibm.com>
2022-01-24 12:36:58 +01:00
Jakob Naucke
67950aefd5
Merge pull request #3330 from Jakob-Naucke/backport-kata-manager-static
stable-2.3 | kata-manager: Retrieve static tarball
2022-01-24 12:02:02 +01:00
Jakob Naucke
bd4ab0c4d5
Merge pull request #3526 from Jakob-Naucke/static-args
stable-2.3 | ci: Pass function arguments in static-checks.sh
2022-01-24 11:39:11 +01:00
Bo Chen
3260adc4a1 virtcontainers: clh: Re-generate the client code
This patch re-generates the client code for Cloud Hypervisor v21.0.
Note: The client code of cloud-hypervisor's (CLH) OpenAPI is
automatically generated by openapi-generator [1-2].

[1] https://github.com/OpenAPITools/openapi-generator
[2] https://github.com/kata-containers/kata-containers/blob/main/src/runtime/virtcontainers/pkg/cloud-hypervisor/README.md

Signed-off-by: Bo Chen <chen.bo@intel.com>
(cherry picked from commit 2d799cbfa3)
2022-01-21 13:11:20 -08:00
Bo Chen
cc64461fc8 versions: Upgrade to Cloud Hypervisor v21.0
Highlights from the Cloud Hypervisor release v21.0: 1) Efficient Local
Live Migration (for Live Upgrade); 2) Recommended Kernel is Now 5.15; 3)
Bug fixes on OpenAPI yaml spec file, avoid deadlock for live-migration,
etc.

Details can be found: https://github.com/cloud-hypervisor/cloud-hypervisor/releases/tag/v21.0

Fixes: #3519

Signed-off-by: Bo Chen <chen.bo@intel.com>
(cherry picked from commit 7e15e99d5f)
2022-01-21 13:11:20 -08:00
Jakob Naucke
f2c6cd0808
ci: Pass function arguments in static-checks.sh
e.g. when called from the tests repo

Fixes: #3525
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-01-21 14:57:16 +01:00
Eric Ernst
78afa10ab9 agent: resolve unused variables in tests
A few tests have unused or unread variables. Let's clean these up...

Fixes: #3530
Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-01-16 16:03:14 -08:00
Eric Ernst
a829867674 agent: remove unused field in mount handling
In our parsing of mountinfo, majority of the fields are unused.
Let's stop saving these.

Fixes: #3180

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-01-16 13:26:46 -08:00