Commit Graph

7080 Commits

Author SHA1 Message Date
Fabiano Fidêncio
f4fbf723e1 runtime: Update vendored code
The go vendored code is not up-to-date and the newly added check for
that caught this up as part of
https://github.com/kata-containers/kata-containers/pull/2223/checks?check_run_id=3056830309

Let's take advantage of the `make vendor` target and update the vendored
code. :-)

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:41 +02:00
Fabiano Fidêncio
a20074d45c static-checks: Check the vendored code
Let's ensure we always have the go vendored code up-to-date and that the
rust vendor does actually work.

Fixes: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:41 +02:00
Fabiano Fidêncio
ac8f972e4b build: Add make vendor
Add a top-level `vendor` entry, which will help us when adding the
vendor check as part of the static checks.

Related: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:41 +02:00
Fabiano Fidêncio
f9643d83fb agent-ctl: Add make vendor
This has a similar intent as the go code, but not totally equal.  For
the go code we want to ensure that the vendored code is up-to-date,
while here we want to ensure that `cargo vendor` actually works.

We happened to release a few tarballs where `cargo vendor` didn't work
and it causes some pain for downstream maintainers.

Related: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:41 +02:00
Fabiano Fidêncio
5e69b498ed trace-forwarder: Add make vendor
This has a similar intent as the go code, but not totally equal.  For
the go code we want to ensure that the vendored code is up-to-date,
while here we want to ensure that `cargo vendor` actually works.

We happened to release a few tarballs where `cargo vendor` didn't work
and it causes some pain for downstream maintainers.

Related: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:41 +02:00
Fabiano Fidêncio
a104f13230 agent: Add make vendor
This has a similar intent as the go code, but not totally equal.  For
the go code we want to ensure that the vendored code is up-to-date,
while here we want to ensure that `cargo vendor` actually works.

We happened to release a few tarballs where `cargo vendor` didn't work
and it causes some pain for downstream maintainers.

Related: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:41 +02:00
Fabiano Fidêncio
579b3f34c2 runtime: Add make vendor
Let's add this target so we can actually enforce, as part of the static
checks (which will be added in a follow-up commit), that our vendored go
code is up-to-date.

Related: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:40 +02:00
Fabiano Fidêncio
930ca55d02 runtime: Add make handle_vendor
This will help us to ensure that we always update the vendored code when
needed.   Right now we've been lacking behind and we tend to realise
something change during the next mandatory update, which is not exactly
optimal.

Related: #2159

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-14 13:59:40 +02:00
Fabiano Fidêncio
79977a25ec
Merge pull request #2102 from devimc/2021-06-23/golang1.16
ci: add golang 1.16 to the CI
2021-07-14 13:59:07 +02:00
bin
39546a1070 runtime: delete not used functions
Delete some not used functions in sandbox.go

Fixes: #2230

Signed-off-by: bin <bin@hyper.sh>
2021-07-14 19:42:50 +08:00
Tim Zhang
38dcdc3d91
Merge pull request #2189 from liubin/2187
Update outdated comments and do some minor reworks
2021-07-14 17:39:52 +08:00
bin
d0bc148fe0 runtime: Register defer function at early stage
Register defer function at early stage ensure that
it can be called if the startSandbox fails.

Fixes: #2230

Signed-off-by: bin <bin@hyper.sh>
2021-07-14 17:20:53 +08:00
Tim Zhang
7960689ef7 tracing: replace SimpleSpanProcessor with BatchSpanProcessor
This change make tokio could be use in vsock-exporter.

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-07-14 15:59:52 +08:00
bin
350acb2d6e virtcontainers: refactoring code for error handling in sandbox
Use a defined error variable replade inplace error, and shortcut
for handling errors returned from function calls.

Fixes: #2187

Signed-off-by: bin <bin@hyper.sh>
2021-07-14 14:28:58 +08:00
bin
858f39ef75 virtcontainers: update wrong comments for code
Some comments/URL are old or wrong, update them
to the correct ones.

Fixes: #2187

Signed-off-by: bin <bin@hyper.sh>
2021-07-14 14:28:57 +08:00
bin
e0a19f6a16 virtcontainers: update API documentation
Some functions add context as its first parameter,
the documentation should update.

Fixes: #2187

Signed-off-by: bin <bin@hyper.sh>
2021-07-14 14:28:57 +08:00
Julio Montes
8d6dd2ad61 snap: support golang 1.16.x
Fix build process, set GO111MODULE environment variable to "auto"

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-07-13 12:22:33 -05:00
Julio Montes
a48dc93fd4 versions: update newest golang version
update newest golang version to 1.16.5

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-07-13 12:22:33 -05:00
Julio Montes
3799679109 ci: add 1.16 to the list of golang versions to test
Add 1.16 to the list of golang versions to test

fixes #2101

Signed-off-by: Julio Montes <julio.montes@intel.com>
2021-07-13 12:22:33 -05:00
Jakob Naucke
67dfb0b922
Merge pull request #2219 from Jakob-Naucke/snap-390-ppc-initrd
snap: Build initrd on ppc64le & s390x
2021-07-13 12:17:14 +02:00
Fabiano Fidêncio
bfa8fe3183
Merge pull request #2216 from snir911/static_checks_fix
ci: static checks: use defined target_branch
2021-07-13 10:17:15 +02:00
Fabiano Fidêncio
8c4dd3b421
Merge pull request #2199 from Tim-Zhang/tracing-enhance
trace-forwarder: Add option rustflags, target, build-type for the make
2021-07-13 10:16:21 +02:00
Fabiano Fidêncio
e27080b706
Merge pull request #2221 from jodh-intel/action-honour-force-skip-ci
CI: Honour force-skip-ci label
2021-07-13 08:25:02 +02:00
Tim Zhang
6999dccaa8 trace-forwarder: Add option rustflags, target, build-type for the make
Support rust-flags, target and build-type.

Fixes: #2215

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-07-13 11:35:46 +08:00
Eric Ernst
feeb1ef8b1
Merge pull request #2212 from lifupan/fix_virtiofsd
qemu: stop the virtiofsd specifically
2021-07-12 13:56:04 -07:00
Chelsea Mafrica
61b1a6732b
Merge pull request #2179 from bporter816/bporter816/refactor-tracing
tracing: Consolidate tracing into a new katatrace package
2021-07-12 12:42:01 -04:00
James O. D. Hunt
7db8a85a1f CI: Honour force-skip-ci label
If a PR has the `force-skip-ci` label set, don't run the static tests.

Fixes: #2220.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-07-12 16:11:55 +01:00
Jakob Naucke
007a656173
snap: Build initrd on ppc64le & s390x
instead of image, does not require privileged containers since `losetup`
is not used and is thus more portable for various build environments.

Fixes: #2218
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-12 15:17:30 +02:00
Snir Sheriber
9b8cc4581d ci: static checks: use defined target_branch
Fixes: #2214
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2021-07-12 15:38:37 +03:00
Yujia Qiao
e887b39e95 docs: Update containerd configuration format
`containerd` has adopted a new configuration style. Update the example configuration to reflect the change.

Fixes: #2180

Signed-off-by: Yujia Qiao <qiaoyujia@bytedance.com>
2021-07-12 10:25:21 +00:00
Tim Zhang
6c39c353e6
Merge pull request #2209 from liubin/fix/2208-log-error
runtime: return error if clh's binary doesn't have a normal stat
2021-07-12 15:49:29 +08:00
bin
9081bee2fd runtime: return error if clh's binary has not a normal stat
When checking clh's binary path if valid, return error even
though the error is not a IsNotExist error.

And add errors to log filed when errors occurred.

Fixes: #2208

Signed-off-by: bin <bin@hyper.sh>
2021-07-12 11:16:35 +08:00
Benjamin Porter
b10e3e22b5
tracing: Consolidate tracing into a new katatrace package
Removes custom trace functions defined across the repo and creates
a single trace function in a new katatrace package. Also moves
span tag management into this package and provides a function to
dynamically add a tag at runtime, such as a container id, etc.

Fixes #1162

Signed-off-by: Benjamin Porter <bporter816@gmail.com>
2021-07-11 14:19:51 -05:00
Fabiano Fidêncio
c8f32936d3
Merge pull request #2149 from ManaSugi/fix-order-check-dir
osbuilder: Fix the order of checking the distro config directory
2021-07-11 18:28:32 +02:00
Manabu Sugimoto
88e7075929 osbuilder: Fix the order of checking the distro config directory
Check if the distro config directory exists before using the directory

Fixes: #2148

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-07-11 15:24:25 +09:00
Fabiano Fidêncio
8c921e69ec
Merge pull request #2183 from dgibson/mountinfo-misparse
agent: Fix to parsing of /proc/self/mountinfo
2021-07-10 13:07:12 +02:00
David Gibson
1ab72518b3 agent: Fix to parsing of /proc/self/mountinfo
get_mounts() parses /proc/self/mountinfo in order to get the mountpoints
for various cgroup filesystems.  One of the entries in mountinfo is the
"device" for each filesystem, but for virtual filesystems like /proc, /sys
and cgroups, the device entry is arbitrary.  Depending on the exact rootfs
setup, it can end up being "-".

This breaks get_mounts() because it uses " - " as a separator.  There
really is a " - " separator in mountinfo, but in this case the device entry
shows up as a second one.  Fix this, by changing a split to a splitn, which
will effectively only consider the first " - " in the line.

While we're there, make the warning message more useful, by having it
actually show which line it wasn't able to parse.

fixes #2182

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-07-10 19:30:27 +10:00
fupan.lfp
8f76626fd6 qemu: stop the virtiofsd specifically
We'd better stop the virtiofsd specifically after stop qemu,
instead of depending on the qemu's termination to notify virtiofsd
to exit.

Fixes: #2211

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2021-07-10 17:26:19 +08:00
Fabiano Fidêncio
75356967c6
Merge pull request #2203 from fidencio/wip/fix-static-checks
runtime: Fix lint issues
2021-07-10 10:43:33 +02:00
Fabiano Fidêncio
da3de3c2eb shim-v2: Fix gosimple issue on utils_test.go
For some reason our static check started to get opinionated about code
that's been there for ages.

One of the suggestions is to improve:

```
INFO: Running golangci-lint on /home/fidencio/go/src/github.com/kata-containers/kata-containers/src/runtime/containerd-shim-v2
utils_test.go:76:36: S1039: unnecessary use of fmt.Sprintf (gosimple)
	testDir, err = ioutil.TempDir("", fmt.Sprintf("shimV2-"))
```

And that's what this PR is about.

Fixes: #2204

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-09 17:24:51 +02:00
Fabiano Fidêncio
305fb0547d virtcontainers: Fix gosimple issue on client.go
For some reason our static check started to get opinionated about code
that's been there for ages.

One of the suggestions is to improve:
```
INFO: Running golangci-lint on /home/fidencio/go/src/github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/agent/protocols/client
client.go:431:2: S1017: should replace this `if` statement with an unconditional `strings.TrimPrefix` (gosimple)
	if strings.HasPrefix(sock, "mock:") {
```

And that's what this PR is about.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-09 17:18:08 +02:00
Fabiano Fidêncio
89cf168c92 virtcontainers: Ignore a staticcheck error on cpuset.go
First of all, cpuset.go just comes from kubernetes and we shouldn't be
doing much with this file apart from updating it every now and then
(but that's material for another PR).

Right now, due to some change on the static checks we use as part of our
CI, we started getting issues as:
```
INFO: Running golangci-lint on /home/fidencio/go/src/github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/cpuset
cpuset.go:60:2: SA4005: ineffective assignment to field Builder.done (staticcheck)
	b.done = true
```

For those, let's just ignore the lint and move on.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-07-09 17:17:12 +02:00
Jakob Naucke
f793b28dfd
Merge pull request #2193 from Jakob-Naucke/snap-s390x
snap: Miscellaneous s390x fixes
2021-07-09 11:08:25 +02:00
Jakob Naucke
9577e54e2a
Merge pull request #2168 from Jakob-Naucke/fix-cc-suse-s390x
runtime: Use CC=gcc on all RPM-based s390x
2021-07-09 11:07:35 +02:00
Jakob Naucke
e8ec18a9d8
Merge pull request #2027 from Jakob-Naucke/virtio-blk-ccw
s390x: Enable virtio-blk-ccw
2021-07-08 18:22:44 +02:00
James O. D. Hunt
7a481c3f4f
Merge pull request #2133 from jodh-intel/trace-forwarder-dump-only
forwarder: Add dump only option
2021-07-08 15:17:36 +01:00
Jakob Naucke
2cc9006c26
snap: Miscellaneous s390x fixes
- Ported from https://github.com/kata-containers/tests/pull/3612:
  Install protobuf-compiler for agent build on ppc64le & s390x
- Fixes in image target for ppc64le & s390x
  - Install image instead of initrd since it's preferred
  - Use Ubuntu as base since Alpine requires a musl agent (cannot be
    built on ppc64le & s390x because there is no such Rust target)
- Ported from
  https://github.com/kata-containers/kata-containers/pull/1265:
  Fix vmlinux install path
- Install libseccomp-dev on all architectures, not just x86_64

Fixes: #2192
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 15:02:47 +02:00
Jakob Naucke
28b2c629e3
runtime: Use CC=gcc on SUSE s390x too
This setting is required, as it is on Fedora-likes.

Fixes: #2167
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 15:01:32 +02:00
Jakob Naucke
cfd690b638
virtcontainers: Use virtio-blk-ccw on s390x
if virtio-blk-pci were to be used

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 14:59:47 +02:00
Jakob Naucke
8758ce26b7
agent: Enable virtio-blk-ccw
Forward-port of https://github.com/kata-containers/agent/pull/600.
Enable virtio-blk-ccw devices in agent (virtio-blk for s390x, already
enabled in runtime).

Fixes: #2026

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-07-08 14:59:47 +02:00