Commit Graph

41 Commits

Author SHA1 Message Date
James O. D. Hunt
8ab90e1068 agent-ctl: Allow API specification in JSON format
Update the `agent-ctl` tool to allow API fields to be specified in JSON
format, either directly on the command-line, or via a file URI.

This feature is made possible by enabling `serde` support in the agent
`protocols` crate. Careful use of the `serde` macros allows the
`agent-ctl` tool to accept _partially_ specified API objects in JSON
format; fields that are not specified are set to the default value for
their respective types.

`build.rs` changes based on work by Fupan.

Fixes: #2978.

Contributions-by: Fupan Li <lifupan@gmail.com>
Contributions-by: Bin Liu <bin@hyper.sh>
Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-11-10 10:16:04 +00:00
James O. D. Hunt
87f676062c agent: Remove dynamic tracing APIs
Remove the `StartTracing` and `StopTracing` agent APIs that toggle
dynamic tracing. This is not supported in Kata 2.x, as documented in the
[tracing proposals document](https://github.com/kata-containers/kata-containers/pull/2062).

Fixes: #2985.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-11-09 08:39:06 +00:00
Samuel Ortiz
99450bd1f7 agent: protos: Add a Family field to the Route payload
Our check for the IP family is working as long as we have either a
gateway or a destination IP. Some routes are missing both.
The RT netlink messages provide the IP family information for each
route, so we can carry that piece of information up to the guest. That
will allow for a more reliable route IP family determination.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2021-10-01 14:35:17 +02:00
Hui Zhu
4f066db8da agent: agent.proto: Add AddSwap
Add new fuction AddSwap.  When agent get AddSwap, it will get the device
name from PCIPath and set the device as the swap device.

Fixes: #2201

Signed-off-by: Hui Zhu <teawater@antfin.com>
2021-07-19 23:20:34 +08:00
Manabu Sugimoto
81c5ff1231 agent: Update seccomp configuration for errnoRet and flags
Update:
- Make the type of errnoRet in oci.proto oneof
- Update seccomp_grpc_to_oci that can set errnoRet as EPREM if the
value is empty.
- Update the oci.pb.go based on the above fixes
- Add seccomp errnoRet and flags option to configs in rustjail

Fixes: #1719

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-04-21 12:16:58 +09:00
bin
421439c633 API: remove ProcessListContainer/ListProcesses
This commit will remove ProcessListContainer API from VCSandbox
and ListProcesses from agent.proto.

Fixes: #1668

Signed-off-by: bin <bin@hyper.sh>
2021-04-09 17:34:25 +08:00
Eric Ernst
15c2d7ed30 Merge pull request #1400 from ManaSugi/update-oci-seccomp
oci: Update seccomp configuration
2021-04-07 15:18:19 -07:00
Tim Zhang
02079dbb4f agent: upgrade tokio to 1.0
Fixes: #1257

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-02-25 14:38:32 +08:00
Tim Zhang
947913f6e5 agent/protocols: Remove cargo:rerun-if-changed in build.rs
So that the build.rs will be re-runed if any file
within the package is changed.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-02-24 21:50:47 +08:00
David Gibson
7e92831c7a protocols: Update PCI path names / terminology in agent protocol def
Now that we have types to represent PCI paths on both the agent and
runtime sides, we can update the protocol definitionto use clearer
terminology.

Note that this doesn't actually change the agent protocol, because it just
renames a field without changing its field ID or type.

While we're there fix a trivial rustfmt error in
src/agent/protocols/build.rs

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-19 09:56:08 +11:00
Manabu Sugimoto
660b047306 oci: Update seccomp configuration
Seccomp configuration should be updated to prepare for the future seccomp support based on the latest OCI specification.

Add:
- flags which is used with seccomp(2) in struct LinuxSeccomp
- errnoRet which is errno return code in struct LinuxSyscall
- some new seccomp actions and an architecture

Fixes: #1391

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-02-11 22:37:02 +09:00
Tim Zhang
332fa4c65f agent: switch to async runtime
Fixes: #1209

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-01-18 15:38:15 +08:00
Maksym Pavlenko
5561755e3c agent: Initial switch to async runtime
This commit includes minimal changes in order to switch to Tokio:
- Update protocol crate to generate async server code
- Adds async entry point to the Agent
- Updates agent services signatures in rpc.rs

Fixes: #1209

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-01-11 16:50:53 +08:00
Liu Jiang
406a91ffdd agent: consume ttrpc crate from crates.io
The ttrpc v0.3.0 has been published to crates.io, so consume from
crates.io.

Fixes: #1213

Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2020-12-22 09:46:41 +08:00
David Gibson
a19263e58d agent/protocols: Remove unneeded import from oci.proto
oci.proto imports "google/protobuf/wrappers.proto", but doesn't appear to
use it, which causes a warning from protoc when we compile it.  Remove the
import to fix the warning.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-17 13:06:41 +11:00
David Gibson
a19cf28c26 agent/protocols: Remove some unnecessary include directives from protoc
The generate_go_sources() function in update-generate-proto.sh adds a
number of include directives to the protoc command line.  Some of these
don't appear to be necessary to correctly compile the agent's protocol
files, so remove them.

Amongst other things were directives pointing at the old Kata1 runtime and
agent repositories.  Those ones could be actively harmful by causing odd
dependencies of the Kata2 build on the Kata1 repositories.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-16 12:10:27 +11:00
David Gibson
2b4520904c agent/protocols: Remove some unneeded dependencies for protocol generation
src/agent/protocols/hack/update-generated-proto.sh checks for the presence
of protoc-gen-rust and ttrpc_rust_plugin, but it doesn't actually need
them.  Those tools are needed to generate Rust code from the gRPC proto
files, but that's already handled in src/agent/protocols/build.rs using
Cargo for dependency management.

This script is only needed for the Go code, for which the other tools are
sufficient.

fixes #1198

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-12-16 12:10:27 +11:00
Peng Tao
0896ce80a4 agent: update proto file copyright
Now that it is Ant Group...

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-26 16:03:47 +08:00
Peng Tao
54e23c8302 agent: move gogo.proto out of the github.com namespance
To follow the same namespace scope as other proto files.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-10-25 10:44:53 +08:00
Peng Tao
fba181088b Merge pull request #1021 from Tim-Zhang/autogen-proto
agent: Generate proto files programmatically
2020-10-24 11:12:24 +08:00
Tim Zhang
9e9988df29 agent/protocols: Move agent.proto out of the mock folder of agent
Because the repos have been merged and the agent repo will be removed in the future,
we do not need mock the file structure any more.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-10-23 15:19:35 +08:00
Tim Zhang
9cb4150777 agent/protocols: Fix copyright header checking
Caused by: bb718ba1dd

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-10-22 16:17:24 +08:00
Tim Zhang
0d58d91959 agent/protocols: Stop generate agent proto files in the shellscript
Because the job has been done by build.rs.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-10-22 16:12:21 +08:00
Tim Zhang
7559382b15 agent/protocols: Ignore generated files and remove these files from repo
Files generated by build.rs does not need to be stored in repo.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-10-22 16:12:21 +08:00
Tim Zhang
fdc33fb7bf agent/protocols: Generate proto files programmatically
Build proto with build.rs

Fixes: #1019

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-10-22 16:12:15 +08:00
bin liu
698d25b7ee agent: clear redundant_field_names clippy warning
add `#![allow(clippy::redundant_field_names)]` can skip check
`protocols` package, and fix redundant_field_names in other
packages.

Signed-off-by: bin liu <bin@hyper.sh>
2020-10-21 15:03:16 +08:00
Peng Tao
daf2a54dc8 agent: fix cargo fmt
Otherwise travis fails.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 11:01:07 +08:00
Julio Montes
60245a83fa agent: update Cargo files authors
Anyone can collaborate in the Kata Containers project, so instead of
adding her/his name and email to the Cargo.toml files, use
`The Kata Containers community` as name and
`kata-dev@lists.katacontainers.io` as email.

fixes #643

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-08-31 08:47:10 -05:00
bin liu
1b75daa00f runtime: add new command to collect metrics from Kata containers
Add a new command to collect metrics and return metrics to Prometheus.

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-02 17:54:54 +08:00
bin liu
9fd3e48c80 agent: add new pb message GetMetrics
Add new message and generated codes for `GetMetrics` between runtime and agent.

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-02 10:41:17 +08:00
Peng Tao
380f07ec4b proto: update agent protocol
To add GetOOMEvent API.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:34:38 -07:00
James O. D. Hunt
43db1284e9 Merge pull request #239 from Tim-Zhang/neigh
agent: port https://github.com/kata-containers/agent/pull/784
2020-05-29 15:56:52 +01:00
Tim Zhang
635c7a785a agent: port https://github.com/kata-containers/agent/pull/784
Add grpc API for adding arp neighbours for a network
interface. These are expected to be static arp entries
sent by the runtime.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-05-29 22:28:10 +08:00
Tim Zhang
cb58075a26 agent: fix make generate-protocols errors
Got:
make PROTO_FILE=agent.proto generate-protocol
google/protobuf/descriptor.proto: Read access is denied for file: /usr/local/include/google/protobuf/descriptor.proto

This commit will fix this error.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-05-29 16:05:04 +08:00
Hui Zhu
85256e0494 Merge pull request #236 from liubin/refactoring-proto-compilation
Agent: centrally manage proto files
2020-05-28 10:05:05 +08:00
bin liu
a3eb0c970e Agent: centrally manage proto files
In Kata 1.x, agent interface is defined in agent repo and vendored by runtime. But in Kata 2.0, agent and runtime will use ttrpc as protocol, and agent is using rust language, so runtime can't vendor agent again, have to compile from agent's protobuf files.

This PR will hold proto files under src/agent, and compile it to rust/go sources for agent/runtime. Typing `make generate-protocols` under root of this repo or `src/agent` can see how to use it.

Signed-off-by: bin liu <bin@hyper.sh>
2020-05-27 21:05:36 +08:00
bin liu
9b9f2b2ff0 agent: porting https://github.com/kata-containers/agent/pull/616
this PR will port the original PR to kata 2.0.

Signed-off-by: bin liu <bin@hyper.sh>
2020-05-26 18:17:54 +08:00
fupan.lfp
08e3d259ca agent: fix the issue of building error with latest ttrpc
Since the ttrpc upgraded with async supported, which isn't
compatible with current agent, thus it's better to change
the dependency to a stable branch.

Fixes: #229

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-05-26 11:14:39 +08:00
fupan.lfp
3ea23a9a5d add license headers to proto files
add license headers to proto files

Fixes: #148

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-04-22 22:12:38 +08:00
lifupan
a7041c27dc agent: switch from grpc to ttrpc as agent protocol
switch from grpc to ttrpc
Fixes: #148

Signed-off-by: lifupan <lifupan@gmail.com>
2020-04-22 22:12:18 +08:00
Yang Bo
f8ced638d2 rust-agent: Land rust agent into kata-containers
Fixes: #56

Signed-off-by: Yang Bo <bo@hyper.sh>
2019-10-31 10:46:45 +08:00