Commit Graph

2078 Commits

Author SHA1 Message Date
Christophe de Dinechin
2e093dfd8b config: Fix typo in function name
There was an extra 'p' in addHypervisorVirtioFsOverrides.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
bf13ff0a3a config: Protect virtio_fs_daemon annotation
Sending the virtio_fs_daemon annotation can be used to execute
arbitrary code on the host. In order to prevent this, restrict the
values of the annotation to a list provided by the configuration
file.

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Christophe de Dinechin
8c75de1966 config: Add 'List' alternates for hypervisor configuration paths
Paths mentioned in the hypervisor configuration can be overriden
using annotations, which is potentially dangerous. For each path,
add a 'List' variant that specifies the list of acceptable values
from annotations.

Bug: https://bugs.launchpad.net/katacontainers.io/+bug/1878234

Fixes: #901

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-10-14 16:10:12 +02:00
Eric Ernst
d8a8fe47fb cpuset: don't set cpuset.mems in the guest
Kata doesn't map any numa topologies in the guest. Let's make sure we
clear the Cpuset fields before passing container updates to the
guest.

Note, in the future we may want to have a vCPU to guest CPU mapping and
still include the cpuset.Cpus. Until we have this support, clear this as
well.

Fixes: #932

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-13 15:54:03 -07:00
Eric Ernst
88cd712876 sandbox: consider cpusets if quota is not enforced
CPUSet cgroup allows for pinning the memory associated with a cpuset to
a given numa node. Similar to cpuset.cpus, we should take cpuset.mems
into account for the sandbox-cgroup that Kata creates.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-13 15:54:03 -07:00
Eric Ernst
77a463e57a cpuset: support setting mems for sandbox
CPUSet cgroup allows for pinning the memory associated with a cpuset to
a given numa node. Similar to cpuset.cpus, we should take cpuset.mems
into account for the sandbox-cgroup that Kata creates.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-13 15:54:03 -07:00
Eric Ernst
2d690536b8 cpuset: add cpuset pkg
Pulled from 1.18.4 Kubernetes, adding the cpuset pkg for managing
CPUSet calculations on the host. Go mod'ing the original code from
k8s.io/kubernetes was very painful, and this is very static, so let's
just pull in what we need.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-13 15:54:03 -07:00
Fabiano Fidêncio
1a9515a998 runtime: Pass --thread-pool-size=1 to virtiofsd
Dave Gilbert brough up that passing --thread-pool-size=1 to virtiofsd
may result in a performance improvement especially when using
`cache=none`. While our current default is `cache=auto`, Dave mentioned
that he seems no harm in having it set and he also mentiond that it may
use a lot less stack space on aarch/arm.

Fixes: #943

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-10-13 22:33:08 +02:00
Eric Ernst
12cc0ee168 sandbox: don't constrain cpus, mem only cpuset, devices
Allow for constraining the cpuset as well as the devices-whitelist . Revert
sandbox constraints for cpu/memory, as they break the K8S use case. Can
re-add behind a non-default flag in the future.

The sandbox CPUSet should be updated every time a container is created,
updated, or removed.

To facilitate this without rewriting the 'non constrained cgroup'
handling, let's add to the Sandbox's cgroupsUpdate function.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-12 21:31:27 -07:00
Eric Ernst
b6cf68a985 cgroups: add ability to update CPUSet
Add function for applying a cpuset change to a cgroup

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-12 21:31:27 -07:00
Eric Ernst
b812d4f7fa virtcontainers: add method for calculating cpuset for sandbox
Calculate sandbox's CPUSet as the union of each of the container's
CPUSets.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2020-10-12 21:31:27 -07:00
Bin Liu
43da14e7b3 Merge pull request #752 from YchauWang/clear-moke-code01
runtime: Clear the VCMock 1.x API Methods from 2.0
2020-10-09 17:41:21 +08:00
Jose Carlos Venegas Munoz
c4472481bc virtiofs: Disable DAX
virtiofs DAX support is not stable today, there are
a few corner cases to make it default.

Fixes: #862
Fixes: #875

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2020-10-08 10:59:10 -05:00
Bo Chen
c33ee54a21 clh: Support VFIO device unplug
This patch adds the support of VFIO device unplug when using
cloud-hypervisor.

Fixes: #860

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-05 12:20:13 -07:00
Bo Chen
1f4dfa3166 clh: Remove unnecessary VmmPing
We can rely on the error handling of the actual HTTP API calls to catch
errors, and don't need to call VmmPing explicitly in advance.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-05 12:17:45 -07:00
Bo Chen
cc80ae0afb versions: cloud-hypervisor: Bump to version 6d30fe05
The cloud-hypervisor commit `6d30fe05` introduced a fix on its API for
VFIO device hotplug (`VmAddDevice`), which is required for supporting
VFIO unplug through openAPI calls in kata.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-05 12:13:36 -07:00
Julio Montes
ea1cb37b59 versions: cloud-hypervisor: bump version
Use commit c54452c08a467a3e35d8d72f2a91d424e9718c57 as
version for cloud-hypervisor.
Bring openapi fix cloud-hypervisor/cloud-hypervisor#1760 to
support SGX.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Julio Montes
0ebffdf29f runtime: cloud-hypervisor: tag openapi-generator-cli container
Tag openapi-generator-cli container to v4.3.1 that is the latest
stable, this way we can have reproducible builds and the same
generated code in all the systems

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Julio Montes
7d63823141 runtime/vendor: add k8s.io/apimachinery/pkg/api/resource
k8s.io/apimachinery/pkg/api/resource is a memory quantities parser,
we use it to parse the SGX EPC size defined by the `sgx.intel.com/epc`
annotation

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Julio Montes
6df165c19d runtime: add support for SGX
Support the `sgx.intel.com/epc` annotation that is defined by the intel
k8s plugin. This annotation enables SGX. Hardware-based isolation and
memory encryption.

For example, use `sgx.intel.com/epc = "64Mi"` to create a container
with 1 EPC section with pre-allocated memory.

At the time of writing this patch, SGX patches have not landed on the
linux kernel project.
The following github kernel fork contains all the SGX patches for the
host and guest: https://github.com/intel/kvm-sgx

fixes #483

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Peng Tao
414b906e9c Merge pull request #747 from Kvasscn/fix-warning-in-device-manager-test
devices: fix go test warning in manager_test.go
2020-09-30 20:37:20 +08:00
Peng Tao
496ac0a4f5 Merge pull request #516 from liubin/feature/472-integrate-fc-metrics
fc: integrate Firecracker's metrics
2020-09-29 21:30:37 +08:00
bin liu
757dfa70e6 fc: integrate Firecracker's metrics
Firecracker expose metrics through fifo file
and using a JSON format. This PR will parse the
Firecracker's metrics and convert to Prometheus metrics.

Fixes: #472

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-28 15:20:02 +08:00
Peng Tao
85d22301e9 runtime: fix TestNewConsole UT failure
It needs root.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 11:02:56 +08:00
Peng Tao
5611283ec5 runtime: fix golint errors
Need to run gofmt -s on them.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 11:01:07 +08:00
Peng Tao
1569b3b32a docs: fix static check errors
Somehow we are not running static checks for a long time.
And that ended up with a lot for errors.

* Ensure debug options are valid is dropped
* fix snap links
* drop extra CONTRIBUTING.md
* reference kata-pkgsync
* move CODEOWNERS to proper place
* remove extra CODE_OF_CONDUCT.md.
* fix spell checker error on Developer-Guide.md

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 11:01:03 +08:00
Peng Tao
df3119b679 runtime: fix make check
Need to use the correct script path.

Fixes: #802
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 10:24:49 +08:00
Peng Tao
5596eaa31d Merge pull request #441 from liubin/feature/245-add-debug-console
kata 2.0: add debug console service
2020-09-28 10:06:13 +08:00
Peng Tao
ac6f020c6c Merge pull request #697 from keloyang/destroy
runtime: Call s.newStore.Destroy if globalSandboxList.addSandbox
2020-09-27 16:30:24 +08:00
Peng Tao
b20ca6334b Merge pull request #733 from cailca/732
shimv2: add a comment in checkAndMount()
2020-09-27 16:29:51 +08:00
bin liu
484a595f1a runtime: add enable_debug_console configuration item for agent
Set enable_debug_console=true in Kata's congiguration file,
runtime will pass `agent.debug_console`
and `agent.debug_console_vport=1026` to agent.

Fixes: #245

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-27 15:04:59 +08:00
bin liu
febdf8f68c runtime: add debug console service
Add `kata-runtime exec` to enter guest OS
through shell started by agent

Fixes: #245

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-27 10:57:17 +08:00
zhanghj
07d339c788 devices: fix go test warning in manager_test.go
Create "class" and "config" file in temporary device BDF dir,
and remove dir created  by ioutil.TempDir() when test finished.

fixes: #746

Signed-off-by: zhanghj <zhanghj.lc@inspur.com>
2020-09-26 20:46:12 -04:00
Peng Tao
594519d883 Merge pull request #790 from likebreath/upgrade_clh_v0.10.0
runtime: Update CLH client pkg to version v0.10.0
2020-09-25 11:51:11 +08:00
James O. D. Hunt
ce9a4eeffd Merge pull request #784 from jodh-intel/2.0-dev-fix-linter-errors
runtime: Fix linter errors in release files
2020-09-24 08:40:19 +01:00
Bo Chen
a34478ffa5 runtime: Update cloud-hypervisor client pkg to version v0.10.0
The latest release of cloud-hypervisor v0.10.0 contains the following
updates: 1) `virtio-block` Support for Multiple Descriptors; 2) Memory
Zones; 3) `Seccomp` Sandbox Improvements; 4) Preliminary KVM HyperV
Emulation Control; 5) various bug fixes and refactoring.

Note that this patch updates the client code of clh's HTTP API in kata,
while the 'versions.yaml' file was updated in an earlier PR.

Fixes: #789

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-23 17:37:34 -07:00
Christophe de Dinechin
1c1b4c9c43 Merge pull request #718 from fgiudici/podman_data_collection_script
runtime: add podman configuration to data collection script
2020-09-23 16:01:47 +02:00
James O. D. Hunt
33585a8edc runtime: Fix linter errors in release files
Fix the linter errors caught in the `runtime` repos `master` branch [1],
but not in the `2.0-dev` branch [2]. See [3] for further details.

[1] - https://github.com/kata-containers/runtime/pull/2976
[2] - https://github.com/kata-containers/kata-containers/pull/735
[3] - https://github.com/kata-containers/tests/issues/2870

Fixes: #783.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-09-23 09:24:54 +01:00
Shukui Yang
3523167d20 runtime: Call s.newStore.Destroy if globalSandboxList.addSandbox
Fixes: #696

Signed-off-by: Shukui Yang <keloyangsk@gmail.com>
2020-09-22 22:47:57 +08:00
Francesco Giudici
eae2159168 runtime: add podman configuration to data collection script
Be more verbose about podman configuration in the output of the data
collection script: get the system configuration as seen by podman and
dump the configuration files when present.

Fixes: #243
Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2020-09-22 10:35:45 +02:00
James O. D. Hunt
1a77f69e15 runtime: make kata-check check for newer release
Update `kata-check` to see if there is a newer version available for
download. Useful for users installing static packages (without a package
manager).

Fixes: #734.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-09-21 13:47:29 +01:00
Ychau Wang
1839dfd95a runtime: Clear the VCMock 1.x API Methods from 2.0
Clear the 1.x branch api methods in the 2.0. Keep the same methods to
the VC interface, like the VCImpl struct.

Fixes: #751

Signed-off-by: Ychau Wang <wangyongchao.bj@inspur.com>
2020-09-18 16:30:12 +08:00
Peng Tao
7e33e36f4a Merge pull request #698 from liubin/feature/146-add-cgroup-v2-for-agent
agent: add cgroup v2 support
2020-09-18 14:45:38 +08:00
Peng Tao
922a55e4fe Merge pull request #737 from cailca/736
runtime: Don't use hard-coded crio config
2020-09-18 14:23:14 +08:00
Qian Cai
295f5100a3 runtime: Don't use hard-coded crio config
In show_container_mgr_details(), it used "cat /etc/crio/crio.conf"
instead of "crio config".

Fixes: #736
Signed-off-by: Qian Cai <cai@redhat.com>
2020-09-16 08:38:54 -04:00
Peng Tao
6487044fa1 shimv2: trust cached status when deleting containers
vc status might not be accurate because it does not watch container
status change.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-16 16:47:56 +08:00
Peng Tao
325a4f868d shimv2: do not kill a stopped exec process
Same as containers, it is possible for an exec process to stop so
quickly that containerd may send a parallel Kill request. We should
just return success in such case.

Fixes: #716
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-16 16:47:46 +08:00
bin liu
d7c77b69dc runtime: write oom file to notify CRI-O tha OOM occurred
CRI-O is not use event like containerd, it's depending on
file name `oom` to dectect if an OOM occurred.

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-16 10:35:28 +08:00
Qian Cai
7225460a68 shimv2: add a comment in checkAndMount()
In checkAndMount(), it is not clear why we check IsBlockDevice() and if
DisableBlockDeviceUse == false and then only return "false, nil" instead
of "false, err". Adding a comment to make it a bit more readable.

Fixes: #732
Signed-off-by: Qian Cai <cai@redhat.com>
2020-09-15 13:01:03 -04:00
bin liu
15065e4472 agent: add cgroup v2 support
This PR add basic cgroup v2 support for agent.

Fixes: #146, #357

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-15 10:38:55 +08:00