Commit Graph

8929 Commits

Author SHA1 Message Date
Yibo Zhuang
532d53977e runtime: fsGroup support for direct-assigned volume
The fsGroup will be specified by the fsGroup key in
the direct-assign mountinfo metadate field.
This will be set when invoking the kata-runtime
binary and providing the key, value pair in the metadata
field. Similarly, the fsGroupChangePolicy will also
be provided in the mountinfo metadate field.

Adding an extra fields FsGroup and FSGroupChangePolicy
in the Mount construct for container mount which will
be populated when creating block devices by parsing
out the mountInfo.json.

And in handleDeviceBlockVolume of the kata-agent client,
it checks if the mount FSGroup is not nil, which
indicates that fsGroup change is required in the guest,
and will provide the FSGroup field in the protobuf to
pass the value to the agent.

Fixes #4018

Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
2022-04-11 08:41:13 -07:00
Yibo Zhuang
6a47b82c81 proto: fsGroup support for direct-assigned volume
This change adds two fields to the Storage pb

FSGroup which is a group id that the runtime
specifies to indicate to the agent to perform a
chown of the mounted volume to the specified
group id after mounting is complete in the guest.

FSGroupChangePolicy which is a policy to indicate
whether to always perform the group id ownership
change or only if the root directory group id
does not match with the desired group id.

These two fields will allow CSI plugins to indicate
to Kata that after the block device is mounted in
the guest, group id ownership change should be performed
on that volume.

Fixes #4018

Signed-off-by: Yibo Zhuang <yibzhuang@gmail.com>
2022-04-11 08:41:13 -07:00
Braden Rayhorn
9d5e7ee0d4
agent: add tests for mount_storage
Add test coverage for mount_storage function in src/mount.rs.

Fixes: #4068

Signed-off-by: Braden Rayhorn <bradenrayhorn@fastmail.com>
2022-04-10 21:42:20 -05:00
bin
f8cc5d1ad8 kata-monitor: add some links when generating pages for browsers
Add some links to rendered webpages for better user experience,
let users can jump to pages only by clicking links in browsers.

Fixes: #4061

Signed-off-by: bin <bin@hyper.sh>
2022-04-11 09:29:56 +08:00
Fabiano Fidêncio
698e45f403
Merge pull request #4057 from bradenrayhorn/test-parse-mount-flags-and-options
agent: add test coverage for parse_mount_flags_and_options function
2022-04-08 14:42:18 +02:00
Fabiano Fidêncio
761e8313de
Merge pull request #3985 from bradenrayhorn/test-do-write-stream
agent: add tests for do_write_stream function
2022-04-08 14:34:57 +02:00
Peng Tao
4f551e3428
Merge pull request #4048 from liubin/fix/3303-delete-virtiofsd-debug-option
runtime: delete debug option in virtiofsd
2022-04-08 15:42:38 +08:00
Peng Tao
a83a16e32c
Merge pull request #4059 from garrettmahin/test-process-grpc-to-oci
rustjail: add test coverage for process_grpc_to_oci function
2022-04-08 15:39:28 +08:00
Peng Tao
95e45fab38
Merge pull request #4053 from ManaSugi/fix-makefile-for-features
agent: Allow the agent to be rebuilt with the change of Cargo features
2022-04-08 15:38:25 +08:00
garrettmahin
c31cd0e81a rustjail: add test coverage for process_grpc_to_oci function
Add test coverage for the process_grpc_to_oci function in src/rustjail/lib.rs

Fixes #4058

Signed-off-by: Garrett Mahin <garrett.mahin@gmail.com>
2022-04-07 20:50:48 -05:00
Bin Liu
9c1c219a3f
Merge pull request #4007 from liubin/fix/3959-add-csi-rs-to-gitignore
protocols: add src/csi.rs to .gitignore
2022-04-08 09:33:04 +08:00
Braden Rayhorn
1118a3d2da
agent: add test coverage for parse_mount_flags_and_options function
Add test coverage for the parse_mount_flags_and_options function
in src/mount.rs.

Fixes #4056

Signed-off-by: Braden Rayhorn <bradenrayhorn@fastmail.com>
2022-04-07 17:46:35 -05:00
bin
9d5b03a1b7 runtime: delete debug option in virtiofsd
virtiofsd's debug will be enabled if hypervisor's debug has been
enabled, this will generate too many noisy logs from virtiofsd.

Unbind the relationship of log level between virtiofsd and
hypervisor, if users want to see debug log of virtiofsd,
can set it by:

  virtio_fs_extra_args = ["-o", "log_level=debug"]

Fixes: #3303

Signed-off-by: bin <bin@hyper.sh>
2022-04-07 19:55:22 +08:00
Manabu Sugimoto
eff7c7e0ff agent: Allow the agent to be rebuilt with the change of Cargo features
This allows the kata-agent to be rebuilt when Cargo "features" is
changed. The Makefile for the agent do not need to specify the
sources for prerequisites by having Cargo check for the sources
changes.

Fixes: #4052

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-04-07 20:09:20 +09:00
Greg Kurz
d0d3787233
Merge pull request #3696 from shippomx/main
kata-runtime enable hugepage support
2022-04-06 16:47:04 +02:00
Fabiano Fidêncio
465d3a5506
Merge pull request #4012 from nubificus/how-to-fc-guide
docs: Add a firecracker installation guide
2022-04-06 12:59:55 +02:00
Jaylyn Ren
b975f2e8d2 Virtcontainers: Enable hot plugging vhost-user-blk device on ARM
The vhost-user-blk can be hotplugged on the PCI bridge successfully on
X86, but failed on Arm. However, hotplugging it on Root Port as a PCIe
device can work well on ARM.
Open the "pcie_root_port" in configuration.toml is needed.

Fixes: #4019

Signed-off-by: Jaylyn Ren <jaylyn.ren@arm.com>
2022-04-06 17:37:51 +08:00
bin
962d05ec86 protocols: add src/csi.rs to .gitignore
After running make in src/agent, the git working area will be changed:

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	src/libs/protocols/src/csi.rs

The generated file by `build.rs` should be ignored in git.

Fixes: #3959

Signed-off-by: bin <bin@hyper.sh>
2022-04-06 09:55:38 +08:00
Fabiano Fidêncio
b39caf43f1
Merge pull request #3923 from Jakob-Naucke/no-initrd-se
runtime: Allow and require no initrd for SE
2022-04-05 09:26:07 +02:00
Feng Wang
354cd3b9b6 runtime: Base64 encode the direct volume mountInfo path
This is to avoid accidentally deleting multiple volumes.

Fixes #4020

Signed-off-by: Feng Wang <feng.wang@databricks.com>
2022-04-04 19:56:46 -07:00
Braden Rayhorn
485aeabb6b
agent: add tests for do_write_stream function
Add test coverage for do_write_stream function of AgentService
in src/rpc.rs. Includes minor refactoring to make function more
easily testable.

Fixes #3984

Signed-off-by: Braden Rayhorn <bradenrayhorn@fastmail.com>
2022-04-04 08:21:01 -05:00
George Ntoutsos
4405b188e8 docs: Add a firecracker installation guide
Add info on setting up kata with firecracker.

Fixes: #3555

Signed-off-by: George Ntoutsos <gntouts@nubificus.co.uk>
Signed-off-by: Anastassios Nanos <ananos@nubificus.co.uk>
2022-04-04 14:59:41 +03:00
Archana Shinde
e62bc8e7f3
Merge pull request #3915 from Juneezee/test/t.TempDir
test: use `T.TempDir` to create temporary test directory
2022-04-04 01:34:46 -07:00
Fabiano Fidêncio
8980d04e25
Merge pull request #4023 from fidencio/wip/expose-service-offload-option-to-clh
clh: Expose service offload configuration
2022-04-01 14:10:33 +02:00
Fabiano Fidêncio
3f668b84f3
Merge pull request #4025 from bergwolf/2.5.0-alpha0-branch-bump
# Kata Containers 2.5.0-alpha0
2022-04-01 14:00:19 +02:00
Fabiano Fidêncio
98750d792b clh: Expose service offload configuration
This configuration option is valid for all the hypervisor that are going
to be used with the confidential containers effort, thus exposing the
configuration option for Cloud Hypervisor as well.

Fixes: #4022

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-04-01 11:15:55 +02:00
Greg Kurz
bbdfac4fd8
Merge pull request #4011 from gkurz/bump-fc-0-23-4
versions: Bump firecracker to v0.23.4
2022-04-01 11:01:15 +02:00
Bin Liu
416cc90b7a
Merge pull request #3972 from wfly1998/main
agent: use ms as unit of cputime instead of ticks
2022-04-01 15:34:06 +08:00
Peng Tao
c9e24433d8 release: Kata Containers 2.5.0-alpha0
- agent: fix container stop error with signal SIGRTMIN+3
- doc: Improve kata-deploy README.md by changing sh blocks to bash blocks
- docs: Remove kata-proxy reference
- kata-monitor: fix duplicated output when printing usage
- Stop getting OOM events from agent for "ttrpc closed" error
- tools/packaging: Fix error path in `kata-deploy-binaries.sh -s`
- kata-deploy: fix version bump from -rc to stable
- release: Include all the rust vendored code into the vendored tarball
- docs: Remove VPP documentation
- runtime: Remove the explicit VirtioMem set and fix the comment
- tools/packaging/kata-deploy: Copy install_yq.sh before starting parallel builds
- docs: Remove kata-proxy references in documentation
- agent: Signal the whole process group
- osbuilder/qat: don't pull kata sources if exist
- docs: fix markdown issues in how-to-run-docker-with-kata.md
- osbuilder/qat: use centos as base OS
- docs: Update vcpu handling document
- Agent: fix unneeded late initialization lint
- static-build,clh: Add the ability to build from a PR
- Don't use a globally installed mock hook for hook tests
- ci: Weekly check whether the docs url is alive
- Multistrap Ubuntu & enable cross-building guest
- device: using const strings for block-driver option instead of hard coding
- doc: update Intel SGX use cases document
- tools: update QEMU to 6.2
- action: Update link for format patch documentation
- runtime: properly handle ESRCH error when signaling container
- docs: Update k8s documentation
- rustjail: optimization, merged several writelns into one
- doc: fix kata-deploy README typo
- versions: Upgrade to Cloud Hypervisor v22.1
- Add debug and self-test control options to Kata Manager
- scripts: Change here document delimiters
- agent: add tests for get_memory_info function
- CI: Update GHA secret name
- tools: release: Do not consider release candidates as stable releases
- kernel: fix cve-2022-0847
- docs: Update contact link in runtime README
- Improve error checking of hugepage allocation
- CI: Create GHA to add PR sizing label
- release: Revert kata-deploy changes after 2.4.0-rc0 release

2b91dcfe docs: Remove kata-proxy reference
0d765bd0 agent: fix container stop error with signal SIGRTMIN+3
a63bbf97 kata-monitor: fix duplicated output when printing usage
9e4ca0c4 doc: Improve kata-deploy README.md by changing sh blocks to bash blocks
a779e19b tools/packaging: Fix error path in 'kata-deploy-binaries.sh -s'
0baebd2b tools/packaging: Fix usage of kata-deploy-binaries.sh
3606923a workflows,release: Ship *all* the rust vendored code
2eb07455 tools: Add a generate_vendor.sh script
5e1c30d4 runtime: add logs around sandbox monitor
fb8be961 runtime: stop getting OOM events when ttrpc: closed error
93d03cc0 kata-deploy: fix version bump from -rc to stable
a9314023 docs: Remove kata-proxy references in documentation
66f05c5b runtime: Remove the explicit VirtioMem set and fix the comment
0928eb9f agent: Kill the all the container processes of the same cgroup
c2796327 osbuilder/qat: don't pull kata sources if exist
154c8b03 tools/packaging/kata-deploy: Copy install_yq.sh in a dedicated script
1ed7da8f packaging: Eliminate TTY_OPT and NO_TTY variables in kata-deploy
bad859d2 tools/packaging/kata-deploy/local-build: Add build to gitignore
19f372b5 runtime: Add more debug logs for container io stream copy
459f4bfe osbuilder/qat: use centos as base OS
9a5b4770 docs: Update vcpu handling document
ecf71d6d docs: Remove VPP documentation
c77e34de runtime: Move mock hook source
86723b51 virtcontainers: Remove unused install/uninstall targets
0e83c95f virtcontainers: Run mock hook from build tree rather than system bin dir
77434864 docs: fix markdown issues in how-to-run-docker-with-kata.md
32131cb8 Agent: fix unneeded late initialization lint
e65db838 virtcontainers: Remove VC_BIN_DIR
c20ad283 virtcontainers: Remove unused Makefile defines
c776bdf4 virtcontainers: Remove unused parameter from go-test.sh
ebec6903 static-build,clh: Add the ability to build from a PR
24b29310 doc: update Intel SGX use cases document
18d4d7fb tools: update QEMU to 6.2
62351637 action: Update link for format patch documentation
aa5ae6b1 runtime: Properly handle ESRCH error when signaling container
efa19c41 device: use const strings for block-driver option instead of hard coding
dacf6e39 doc: fix filename typo
92ce5e2d rustjail: optimization, merged several writelns into one
7a18e32f versions: Upgrade to Cloud Hypervisor v22.1
5c434270 docs: Update k8s documentation
5d6d39be scripts: Change here document delimiters
be12baf3 manager: Change here documents to use standard delimiter
9576a7da manager: Add options to change self test behaviour
d4d65bed manager: Add option to enable component debug
019da91d manager: Whitespace fix
d234cb76 manager: Create containerd link
c088a3f3 agent: add tests for get_memory_info function
4b1e2f52 CI: Update GHA secret name
ffdf961a docs: Update contact link in runtime README
5ec7592d kernel: fix cve-2022-0847
6a850899 CI: Create GHA to add PR sizing label
2b41d275 release: Revert kata-deploy changes after 2.4.0-rc0 release
4adf93ef tools: release: Do not consider release candidates as stable releases
72f7e9e3 osbuilder: Multistrap Ubuntu
df511bf1 packaging: Enable cross-building agent
0a313eda osbuilder: Fix use of LIBC in rootfs.sh
2c86b956 osbuilder: Simplify Rust installation
0072cc2b osbuilder: Remove musl installations
5c3e5536 osbuilder: apk add --no-cache
42e35505 agent: Verify that we allocated as many hugepages as we need
608e003a agent: Don't attempt to create directories for hugepage configuration
168fadf1 ci: Weekly check whether the docs url is alive

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2022-04-01 06:23:21 +00:00
Bin Liu
5d0adb2164
Merge pull request #3995 from wxx213/main
agent: fix container stop error with signal SIGRTMIN+3
2022-04-01 11:29:14 +08:00
David Esparza
a06e51dae0
Merge pull request #3944 from dborquez/improve-readme-format
doc: Improve kata-deploy README.md by changing sh blocks to bash blocks
2022-03-31 14:48:53 -06:00
GabyCT
f026e78716
Merge pull request #4014 from GabyCT/topic/acrndoc
docs: Remove kata-proxy reference
2022-03-31 12:01:13 -06:00
Gabriela Cervantes
2b91dcfeef docs: Remove kata-proxy reference
This PR removes the kata-proxy reference from this document as it is
not longer a component in kata 2.0

Fixes #4013

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-03-31 16:30:03 +00:00
Greg Kurz
0d5f80b803 versions: Bump firecracker to v0.23.4
This release changes Docker images repository from DockerHub to Amazon
ECR. This resolves the `You have reached your pull rate limit` error
when building the firecracker tarball.

Fixes #4001

Signed-off-by: Greg Kurz <groug@kaod.org>
2022-03-31 13:25:19 +02:00
Wang Xingxing
0d765bd082 agent: fix container stop error with signal SIGRTMIN+3
The nix::sys::signal::Signal package api cannot deal with SIGRTMIN+3,
directly use libc function to send the signal.

Fixes: #3990

Signed-off-by: Wang Xingxing <stellarwxx@163.com>
2022-03-31 10:49:45 +08:00
Eng Zer Jun
59c7165ee1
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

This commit also updates the unit test advice to use `T.TempDir` to
create temporary directory in tests.

Fixes: #3924

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-31 09:31:36 +08:00
snir911
18dc578134
Merge pull request #3999 from fgiudici/kata-monitor_fix_help
kata-monitor: fix duplicated output when printing usage
2022-03-30 18:56:59 +03:00
Francesco Giudici
a63bbf9793 kata-monitor: fix duplicated output when printing usage
(default: "/run/containerd/containerd.sock") is duplicated when
printing kata-monitor usage:

[root@kubernetes ~]# kata-monitor --help
Usage of kata-monitor:
  -listen-address string
        The address to listen on for HTTP requests. (default ":8090")
  -log-level string
        Log level of logrus(trace/debug/info/warn/error/fatal/panic). (default "info")
  -runtime-endpoint string
        Endpoint of CRI container runtime service. (default: "/run/containerd/containerd.sock") (default "/run/containerd/containerd.sock")

the golang flag package takes care of adding the defaults when printing
usage. Remove the explicit print of the value so that it would not be
printed on screen twice.

Fixes: #3998

Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2022-03-30 11:58:53 +02:00
David Esparza
9e4ca0c4f8 doc: Improve kata-deploy README.md by changing sh blocks to bash blocks
The idea is to pass this README file to kata-doc-to-script.sh script and
then execute the result.

Added comments with a file name on top of each YAML snippet.
This helps in assigning a file name when we cat the YAML to a file.

Fixes: #3943

Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
2022-03-30 05:30:41 -04:00
Peng Tao
6837ab7213
Merge pull request #3989 from liubin/fix/3815-redue-oom-logs
Stop getting OOM events from agent for "ttrpc closed" error
2022-03-30 17:02:05 +08:00
snir911
f1a88371c8
Merge pull request #3991 from gkurz/fix-kata-deploy-binaries-sh
tools/packaging: Fix error path in `kata-deploy-binaries.sh -s`
2022-03-30 11:51:43 +03:00
Hui Zhu
e1a39bde8b
Merge pull request #3987 from bergwolf/kata-deploy
kata-deploy: fix version bump from -rc to stable
2022-03-30 16:13:27 +08:00
Fabiano Fidêncio
e1875d1879
Merge pull request #3974 from fidencio/wip/release-include-all-rust-vendored-code-to-the-vendored-tarball
release: Include all the rust vendored code into the vendored tarball
2022-03-29 23:25:17 +02:00
Greg Kurz
a779e19bee tools/packaging: Fix error path in 'kata-deploy-binaries.sh -s'
`make kata-tarball` relies on `kata-deploy-binaries.sh -s` which
silently ignores errors, and you may end up with an incomplete
tarball without noticing it because `make`'s exit status is 0.

`kata-deploy-binaries.sh` does set the `errexit` option and all the
code in the script seems to assume that since it doesn't do error
checking. Unfortunately, bash automatically disables `errexit` when
calling a function from a conditional pipeline, like done in the `-s`
case:

	if [ "${silent}" == true ]; then
		if ! handle_build "${t}" &>"$log_file"; then
                ^^^^^^
           this disables `errexit`

and `handle_build` ends with a `tar tvf` that always succeeds.

Adding error checking all over the place isn't really an option
as it would seriously obfuscate the code. Drop the conditional
pipeline instead and print the final error message from a `trap`
handler on the special ERR signal. This requires the `errtrace`
option as `trap`s aren't propagated to functions by default.

Since all outputs of `handle_build` are redirected to the build
log file, some file descriptor duplication magic is needed for
the handler to be able to write to the orignal stdout and stderr.

Fixes #3757

Signed-off-by: Greg Kurz <groug@kaod.org>
2022-03-29 19:00:46 +02:00
Greg Kurz
0baebd2b37 tools/packaging: Fix usage of kata-deploy-binaries.sh
Add missing documentation for -s .

Signed-off-by: Greg Kurz <groug@kaod.org>
2022-03-29 19:00:46 +02:00
GabyCT
2dc092fe60
Merge pull request #3947 from GabyCT/topic/removevpp
docs: Remove VPP documentation
2022-03-29 10:45:21 -06:00
Fabiano Fidêncio
3606923ac8 workflows,release: Ship *all* the rust vendored code
Instead of only vendoring the code needed by the agent, let's ensure we
vendor all the needed rust code, and let's do it using the newly
introduced enerate_vendor.sh script.

Fixes: #3973

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-29 12:37:00 +02:00
Fabiano Fidêncio
2eb07455d0 tools: Add a generate_vendor.sh script
This script is responsible for generating a tarball with all the rust
vendored code that is needed for fully building kata-containers on a
disconnected environment.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-03-29 12:36:36 +02:00
bin
5e1c30d484 runtime: add logs around sandbox monitor
For debugging purposes, add some logs.

Fixes: #3815

Signed-off-by: bin <bin@hyper.sh>
2022-03-29 16:59:12 +08:00
bin
fb8be96194 runtime: stop getting OOM events when ttrpc: closed error
getOOMEvents is a long-waiting call, it will retry when failed.
For cases of agent shutdown, the retry should stop.

When the agent hasn't detected agent has died, we can also check
whether the error is "ttrpc: closed".

Fixes: #3815

Signed-off-by: bin <bin@hyper.sh>
2022-03-29 16:39:01 +08:00