Commit Graph

6540 Commits

Author SHA1 Message Date
Chelsea Mafrica
33c12b6d08
Merge pull request #1929 from jodh-intel/add-agent-tracing
tracing: Add basic VSOCK tracing
2021-06-02 11:45:41 -07:00
Sandeep Gupta
b26d5b1d08 virtcontainers: Support SEV
fixes #1869

Signed-off-by: Jim Cadden <jcadden@ibm.com>
2021-06-02 14:32:50 -04:00
James O. D. Hunt
a9a0eccf33 tracing: Add basic VSOCK tracing
Implement an openTelemetry custom exporter that sends trace spans to a
VSOCK socket. A VSOCK-to-span converter (such as the Kata trace
forwarder) needs to be running on the host to allow systems like Jaeger
to capture the trace spans.

By default, tracing is not enabled (meaning a NOP tracer is used). To
activate tracing, set the `agent.kata.enable_tracing=true` in the
configuration file.

The type of tracing this change introduces is "static isolated"
tracing. See [1] for further details.

> **Note:**
>
> This change only provides the foundational changes for agent
> tracing work. The feature is _not_ yet complete since it does
> not yet show the correct trace hierarchy.

Fixes: #60.

[1] - https://github.com/kata-containers/agent/blob/master/TRACING.md

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-06-02 18:00:05 +01:00
Jim Cadden
81c6e4ca9f runtime/vendor: add github.com/intel-go/cpuid
Fixes: #1869

Signed-off-by: Jim Cadden <jcadden@ibm.com>
2021-06-02 12:59:04 -04:00
Carlos Venegas
2234b73090 metrics: Add virtiofsd exporter
Export proc stats for virtiofsd.

This commit only adds for hypervisors that have support for it.

- qemu
- cloud-hypervisor

Fixes: #1926

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-06-02 16:06:00 +00:00
Julio Montes
1f0964bad8
Merge pull request #1951 from Tim-Zhang/fix-fd-leak-of-vsock
agent: Upgrade tokio-vsock to fix fd leak of vsock socket
2021-06-02 09:41:10 -05:00
Tim Zhang
9bf781d704 agent: Upgrade tokio-vsock to fix fd leak of vsock socket
Fixes: #1950

The further information: rust-vsock/vsock-rs#15

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-06-02 16:03:09 +08:00
Tim Zhang
476ec9bd86
Merge pull request #1948 from liubin/fix/1947-fix-comments
runtime: fix some comments and logs
2021-06-02 10:52:01 +08:00
Pradipta Banerjee
604e3a6fa1
Merge pull request #1882 from Amulyam24/pef
runtime: Add support for PEF
2021-06-01 12:56:53 +05:30
Peng Tao
41e04495f4
Merge pull request #1943 from bergwolf/cleanup2
cleanup TODOs in runtime
2021-06-01 14:16:46 +08:00
Chelsea Mafrica
bcde703b36
Merge pull request #1859 from cmaf/tracing-attributes-1
tracing: Make runtime span attributes more consistent
2021-05-31 21:57:58 -07:00
bin
b68334a1a8 runtime: fix some comments and logs
This commit fix some conments/logs.
And add some logs for debug.

Fixes: #1947

Signed-off-by: bin <bin@hyper.sh>
2021-06-01 09:04:18 +08:00
Bin Liu
d1ac0a1a2c
Merge pull request #1938 from liubin/fix/1933-virtiofsd-refactor
virtiofsd: refactor qemu.go to use code in virtiofsd.go
2021-06-01 08:32:56 +08:00
Fabiano Fidêncio
d7b6e3e178
Merge pull request #1942 from bergwolf/cleanup
runtime: remove unused doc.go
2021-05-31 22:41:24 +02:00
Peng Tao
1f5b229bef runtime: remove FIXME in SandboxState about CgroupPath
It is in real life usage as we put non constrained sandbox processes
(like shim) in a separate cgroup path.

Fixes: #1944
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-05-29 13:17:14 +08:00
Peng Tao
fee0004ad4 runtime: remove TODO about hot add memory in qemu.go
Already addressed by https://github.com/kata-containers/runtime/pull/786

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-05-29 11:15:50 +08:00
Peng Tao
2e29ef9cab runtime: remove TODO comment from StatusContainer
It is no longer valid as containerd already doesn't treat container pid
as host process pid.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-05-29 11:10:32 +08:00
bin
72cd8f5ef6 virtiofsd: refactor qemu.go to use code in virtiofsd.go
CloudHypervisor is using virtiofsd.go to manage virtiofsd process,
but qemu has its code in qemu.go. This commit let qemu to re-use
code in virtiofsd.go to reduce code and improve maintenanceability.

Fixes: #1933

Signed-off-by: bin <bin@hyper.sh>
2021-05-29 11:00:05 +08:00
Peng Tao
0b22c48d2a runtime: remove unused doc.go
It doesn't even contain any actual code there.

Fixes: #1941
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-05-29 10:25:29 +08:00
Peng Tao
c455d84571
Merge pull request #1918 from lifupan/main
cgroup: fix the issue of set mem.limit and mem.swap
2021-05-29 10:05:44 +08:00
Peng Tao
fd6d32ee42
Merge pull request #1939 from lifupan/fix_epipe
agent: re-enable the standard SIGPIPE behavior
2021-05-29 10:05:09 +08:00
Fabiano Fidêncio
bcf78a18ae
Merge pull request #1932 from liubin/fix/1931-virtiofsd-fd-leak-and-return-right-pid
virtiofsd: Fix file descriptors leak and return correct PID
2021-05-28 12:29:56 +02:00
Fupan Li
a761e980e4
Merge pull request #1934 from liubin/fix/1927-check-SandboxCgroupOnly-and-cgroup-v2
runtime: and cgroup and SandboxCgroupOnly check for check sub-command
2021-05-28 16:43:44 +08:00
fupan.lfp
30f4834c5b cgroup: fix the issue of set mem.limit and mem.swap
When update memory limit, we should adapt the write sequence
for memory and swap memory, so it won't fail because
the new value and the old value don't fit kernel's
validation.

Fixes: #1917

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-05-28 15:44:14 +08:00
fupan.lfp
0ae364c8eb agent: re-enable the standard SIGPIPE behavior
The Rust standard library had suppressed the default SIGPIPE
behavior, see https://github.com/rust-lang/rust/pull/13158.
Since the parent's signal handler would be inherited by it's child
process, thus we should re-enable the standard SIGPIPE behavior as a
workaround.

Fixes: #1887

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-05-28 15:25:05 +08:00
Chelsea Mafrica
05a46fede0 tracing: Make runtime span attributes more consistent
Span attributes (tags) are not consistent in runtime tracing, so
designate and use core attributes such source, package, subsystem, and
type as span metadata for more understandable output.

Use WithAttributes() during span creation to reduce calls to
SetAttributes().

Modify Trace() in katautils to accept slice of attributes so multiple
functions using different attributes can use it.

Fixes #1852

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2021-05-27 10:07:11 -07:00
bin
727bfc4556 runtime: and cgroup and SandboxCgroupOnly check for check sub-command
In kata-runtime check sub-command, checks cgroups and SandboxCgroupOnly
to show message if the SandboxCgroupOnly is not set to true
and cgroup v2 is used.

Fixes: #1927

Signed-off-by: bin <bin@hyper.sh>
2021-05-27 21:19:12 +08:00
James O. D. Hunt
b25ad1ab2c tracing: Make trace-forwarder async
The tracing crates are now async, so update the trace forwarder to use
the new API.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-05-27 10:48:05 +01:00
James O. D. Hunt
45f02227b2 tracing: Add trace points
Use the tracing crate to create automatic trace spans for the _majority_
of top-level modules.

Note that not all functions in the top-level modules can be traced:

- Some functions cannot be traced due to the requirement that all
  function parameters implement the `Debug` trait. In some cases (such
  as `netlink.rs`), objects are being passed that are defined in
  different crates and which do not implement `Debug`.
- Some functions may never return (`signal.rs`).
- Some functions are inlined.
- Some functions are very simple getter/setter functions.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-05-27 10:42:58 +01:00
bin
773deca2f6 virtiofsd: Fix file descriptors leak and return correct PID
This commit will fix two problems:
- Virtiofsd process ID returned to the caller will always be 0,
   the pid var is never being assigned a value.
- Socket listen fd may leak in case of failure of starting virtiofsd process.
  This is a port of be9ca0d58b

Fixes: #1931

Signed-off-by: bin <bin@hyper.sh>
2021-05-27 16:51:41 +08:00
Amulyam24
37a426b4c6 runtime: Add support for PEF
Protected Execution Facility(PEF) is the confidential computing
technology on ppc64le. This PR adds the support for it in Kata.
Also re-vendor govmm for the latest changes.

Fixes: #1881

Signed-off-by: Amulyam24 <amulmek1@in.ibm.com>
2021-05-25 14:29:42 +00:00
Peng Tao
35f297ad50
Merge pull request #1899 from Amulyam24/fragments
kernel: add ppc64le fragments
2021-05-25 10:18:55 +08:00
Fabiano Fidêncio
9fb301f4df
Merge pull request #1920 from ManaSugi/update-kubeadm-flag
docs: Use --ignore-preflight-errors=all flag
2021-05-24 21:12:12 +02:00
Fabiano Fidêncio
c3f6c88668
Merge pull request #1915 from quanweiZhou/fix_start_container_failed_when_drop_all_caps
agent: fix start container failed when dropping all capabilities
2021-05-24 14:13:52 +02:00
Tim Zhang
005e5ddedc
Merge pull request #1905 from ManaSugi/del_underscore_var
agent: Remove unnecessary underscore(_) variables
2021-05-24 17:39:48 +08:00
Manabu Sugimoto
fe670c5de5 docs: Use --ignore-preflight-errors=all flag
The --skip-preflight-checks flag has been deprecated in the Kubernetes v1.9
and removed from Kubernetes v1.12.
We should use --ignore-preflight-errors=all flag instead of --skip-preflight-checks.

Fixes: #1919

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-05-24 18:06:41 +09:00
Fabiano Fidêncio
852aa9454f
Merge pull request #1908 from stevenhorsman/add-doc-for-getting-qemu
docs: Add instructions for getting QEMU source
2021-05-24 10:31:03 +02:00
Fupan Li
c09d8fcfda
Merge pull request #1888 from yuanzhe-liu0/qemu_align
qemu: align before memory hotplug on arm64
2021-05-24 16:13:01 +08:00
stevenhorsman
5b5047bd4a docs: Add instructions for getting QEMU source
Update the developer guide to add instructions of how to get the
correct version of the QEMU source and sets your_qemu_directory
variable, so that follow on steps are easier for a new joiner to the
community to understand

Fixes #1907

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2021-05-23 10:23:18 +01:00
quanweiZhou
3e4ebe10ac agent: fix start container failed when dropping all capabilities
When starting a container and dropping all capabilities,
the init child process has no permission to read the exec.fifo
file because the parent set the file mode 0o622. So change the exec.fifo file mode to 0o644.

fixes #1913

Signed-off-by: quanweiZhou <quanweiZhou@linux.alibaba.com>
2021-05-22 17:33:49 +08:00
Fabiano Fidêncio
c078628544
Merge pull request #1910 from devimc/2021-05-21/snap/updateChannels
workflows: release kata 2.x snap through the stable channel
2021-05-22 09:21:58 +02:00
Julio Montes
9a43d76d5e workflows: release kata 2.x snap through the stable channel
kata 1.x has been deprecated, now kata 2.x can be released through
the stable channel

fixes #1909

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-05-21 15:48:48 -05:00
Fabiano Fidêncio
7dc1d32017
Merge pull request #1897 from egernst/sandbox-bindmount-cleanup
Sandbox bindmount cleanup
2021-05-21 22:36:12 +02:00
GabyCT
6f3b1bb796
Merge pull request #1906 from stevenhorsman/fix-add-customer-agent-command
docs: Update add customer agent command
2021-05-21 15:04:04 -05:00
Eric Ernst
7f1030d303 sandbox-bindmount: persist mount information
Without this, if the shim dies, we will not have a reliable way to
identify what mounts should be cleaned up if `containerd-shim-kata-v2
cleanup` is called for the sandbox.

Before this, if you `ctr run` with a sandbox bindmount defined and SIGKILL the
containerd-shim-kata-v2, you'll notice the sandbox bindmount left on
host.

With this change, the shim is able to get the sandbox bindmount
information from disk and do the appropriate cleanup.

Fixes #1896

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-05-21 12:54:35 -07:00
Eric Ernst
089a7484e1 sandbox: Cleanup if failure to setup sandbox-bindmount occurs
If for any reason there's an error when trying to setup the sandbox
bindmounts, make sure we roll back any mounts already created when
setting up the sandbox.

Without this, we'd leave shared directory mount and potentially
sandbox-bindmounts on the host.

Fixes: #1895

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2021-05-21 12:54:35 -07:00
stevenhorsman
f65acc20dc docs: Update add customer agent command
Update the developer guide to correct the
command that adds a customer kata-agent to the rootfs image
putting it in /usr/bin/kata-agent rather than /bin/kata-agent

Fixes #1904

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2021-05-21 15:42:04 +01:00
Manabu Sugimoto
20a382c158 agent: Remove unnecessary underscore(_) variables
We should remove underscore(_) prefixed variables when ? operator is
used.

Fixes: #1903

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-05-21 17:45:34 +09:00
Fabiano Fidêncio
4b88532c2f docs: Don't use Docker as an example of a container manager
Let's update the doc to use Containerd and CRI-O as examples, which fits
better the 2.x world.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-05-21 09:52:39 +02:00
Fabiano Fidêncio
4142e42465 docs: Don't mention 1.x components as part of the stable branch strategy
Let's slightly rewrite the text to ensure users of 2.x that never had
contact with kata-containers 1.x would be able to understand the
sentences.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-05-21 09:52:39 +02:00