Commit Graph

10590 Commits

Author SHA1 Message Date
Derek McGowan
b9cf0d75a9
Fix panic in metadata content writer on copy error
The `createAndCopy` function is only called when `nw.w` is nil
in order to create a new writer and prepare it. The current code
is attempting to close `nw.w` when there is a copy error. The
correct behavior would be to close the new writer and not touch `nw.w`.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-09-23 10:29:52 -07:00
Samuel Karp
6886c6a2ec
v1 runtime: reduce permissions for bundle dir
Bundle directory permissions should be 0700 by default.  On Linux with
user namespaces enabled, the remapped root also needs access to the
bundle directory.  In this case, the bundle directory is modified to
0710 and group ownership is changed to the remapped root group.

Port of the same change for the v2 runtime

Signed-off-by: Samuel Karp <skarp@amazon.com>
2021-09-22 16:13:10 -07:00
Samuel Karp
7d56b24f1a
v2 runtime: reduce permissions for bundle dir
Bundle directory permissions should be 0700 by default.  On Linux with
user namespaces enabled, the remapped root also needs access to the
bundle directory.  In this case, the bundle directory is modified to
0710 and group ownership is changed to the remapped root group.

Signed-off-by: Samuel Karp <skarp@amazon.com>
2021-09-22 16:13:09 -07:00
Derek McGowan
d0bedc5bd1
Merge pull request #5979 from TianTianBigWang/fix/err-string-fmt
fix error string format
2021-09-22 15:12:18 -07:00
Claudiu Belu
7a7a9a282c integration: Adds test for multilayer image import
This test will make sure there aren't any issues with multilayered
images during import. Keep in mind that in the case of multilayered
images, they have to be unpacked first in order to be usable.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-22 10:03:16 -07:00
Wei Fu
f7658e37d9 runtime: should fail fast if dial error on shim
In linux platform, the shim server always listens on the socket before
the containerd task manager dial it. It is unlikely that containerd task
manager should handle reconnect because the shim can't restart. For this
case, the containerd task manager should fail fast if there is ENOENT or
ECONNREFUSED error.

And if the socket file is deleted during cleanup the exited task, it
maybe cause that containerd task manager takes long time to reload the
dead shim. For that task.v2 manager, the race case is like:

```
TaskService.Delete
  TaskManager.Delete(runtime/v2/manager.go)
    shim.delete(runtime/v2/shim.go)
      shimv2api.Shutdown(runtime/v2/task/shim.pb.go)

      <- containerd has been killed or restarted somehow

      bundle.Delete
```

The shimv2api.Shutdown will cause that the shim deletes socket file
(containerd-shim-runc-v2 does). But the bundle is still there. During
reloading, the containerd will wait for the socket file appears again
in 100 seconds. It is not reasonable. The Reconnect should prevent this
case by fast fail.

Closes: #5648.
Fixes: #5597.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-09-23 00:00:28 +08:00
Sebastiaan van Stijn
483d2e947f
go.mod: update opentelemetry modules to v1.0.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-09-22 16:24:17 +02:00
Maksym Pavlenko
483e23bdcd
Merge pull request #6036 from dmcgowan/add-mirror-action
Add github action to mirror image
2021-09-21 16:06:33 -07:00
Derek McGowan
f6c1e7ed8b
Merge pull request #6027 from alakesh/log-fix
add current process state to the error message
2021-09-21 14:35:33 -07:00
Brian Goff
084387e0b4 Move tracing to plugin
This just makes the implementation a little cleaner.
It also makes the trace exporter pluggable.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-09-21 21:19:46 +00:00
Brian Goff
45c3453a7c Add open telemetry logging hook for logrus
This adds valuable logging data to the open telemetry traces.

When the trace is not recording we don't bother doing anything as it is
relatively expensive to convert logrus data to otel just due to the
nature of how logrus works.

The way this works is that we now set a context on the logrus.Entry that
gets passed around which the hook then uses to determine if there is an
active span to forward the logs to.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-09-21 21:19:28 +00:00
Phil Estes
6fd80dea34
Merge pull request #5991 from akhramov/freebsd/fix-tar-headers
FreeBSD: fix tar headers & the nil check on getxattr
2021-09-21 16:44:24 -04:00
Alakesh Haloi
16f3d67b5a add current process state to the error message
It will aid debugging if a procees delete fails, to figure out whether
it is paused or running.

Signed-off-by: Alakesh Haloi <alakeshh@amazon.com>
2021-09-21 13:29:57 -07:00
Derek McGowan
407d606941
Add github action to mirror image
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-09-21 13:23:51 -07:00
Phil Estes
03d1a0fa72
Merge pull request #6035 from kzys/virt-ip
gha: collect VMs' IP addresses
2021-09-21 15:46:27 -04:00
Kazuyoshi Kato
97df73004e gha: collect Vagrant VMs' IP addresses
To investigate #5748, this change collects Vagrant VMs' IP addresses.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-09-21 11:40:24 -07:00
Artem Khramov
2bffb5f9b2
FreeBSD: fix tar headers & the nil check on getxattr
On FreeBSD + zfs, stat call seem to return garbage in RDev for regular
files & folders. The value returned is large enough not to fit into
`Devmajor` & `Devminor` fields of the tar header. Fortunately, these
fields are required just for special devices.

This change

* adds a check into `setHeaderForSpecialDevice` that the
  input header represents a special device. If it's not the case, we
  don't set the Devmajor & Devminor fields.

* fixes the nil check on `getxattr`: it never returns nils, but rather
  an empty slice instead

Signed-off-by: Artem Khramov <akhramov@pm.me>
2021-09-21 19:22:41 +03:00
Akihiro Suda
3393970dd7
Merge pull request #6033 from zouyee/continuity
bump continuity and console version  that remove pkg/errors
2021-09-22 00:49:49 +09:00
Akihiro Suda
90c6ff97a8
Merge pull request #5997 from ktock/deduped-ref
import: Add option to prevent duplicated digest image
2021-09-21 23:44:19 +09:00
zounengren
7854e0bffe bump continuity and console version that remove pkg/errors
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-21 21:56:18 +08:00
Fu Wei
2e2956ba2d
Merge pull request #5998 from kaijchen/patch-1 2021-09-21 13:32:26 +08:00
Kaijie Chen
16d3f48a2e ctr namespaces: improve usage string
Signed-off-by: Kaijie Chen <chen@kaijie.org>
2021-09-21 12:26:29 +08:00
Akihiro Suda
ecbd7c6533
Merge pull request #6028 from zouyee/bump
bump console version to v1.0.3 that remove pkg/errors
2021-09-21 13:23:41 +09:00
Eng Zer Jun
50da673592
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-21 09:50:38 +08:00
zounengren
a68fb7addb bump console version to v1.0.3 that remove pkg/errors
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-09-21 08:39:12 +08:00
Phil Estes
c16be1a5e2
Merge pull request #6032 from dmcgowan/update-integration-test-images 2021-09-20 18:46:24 -04:00
Derek McGowan
3e72e335fe
Use github images for integration tests
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-09-20 13:35:13 -07:00
Derek McGowan
d72d2794de
Merge pull request #5995 from wssccc/wssccc-patch-2
Fix typo
2021-09-20 11:37:51 -07:00
Michael Crosby
55893b9be7 Add CNI conf based on runtime class
Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-09-17 19:05:06 +00:00
Daniel Canter
50a5685951 Change oci.WithUser behavior for LCOW
The `oci.WithUser` function relies on checking a path on the hosts disk to
grab/validate the uid:gid pair for the user string provided. For LCOW it's a
bit harder to confirm that the user actually exists on the host as a rootfs isn't
mounted on the host and shared into the guest, but rather the rootfs is constructed
entirely in the guest itself. To accomodate this, a spot to place the user string
provided by a client as-is is needed.

The `Username` field on the runtime spec is marked by Platform as only for Windows,
and in this case it *is* being set on a Windows host at least, but will be used as a
temporary holding spot until the guest can use the string to perform these same
operations to grab the uid:gid inside.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-09-17 09:36:24 -07:00
AdamKorcz
65f6a896c3 Fuzzing: Add 4 fuzzers + small modifications
Signed-off-by: AdamKorcz <adam@adalogics.com>
2021-09-17 11:47:28 +01:00
Fu Wei
7ddf5e52ba
Merge pull request #6012 from estesp/set-image-labels 2021-09-16 14:50:10 +08:00
Fu Wei
7d6e9773ac
Merge pull request #5970 from cpuguy83/cancel_on_signal 2021-09-16 09:26:22 +08:00
Brian Goff
2fecf5b02e Make sure exit signals trigger an exit during init
Some cases can cause the server initialization to block (namely running
a 2nd containerd instance by accident against the same root dir). In
this case there is no way to quit the daemon except with `kill -9`.

This changes context things so that server init is done in a goroutine
and we wait on a channel for it to be ready while we also wait for a
ctx.Done(), which will be cancelled if there is a termination signal.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2021-09-15 22:14:46 +00:00
Phil Estes
f40df3d72b
Enable image config labels in ctr and CRI container creation
Signed-off-by: Phil Estes <estesp@amazon.com>
2021-09-15 15:31:19 -04:00
Phil Estes
d081457ba4
Merge pull request #5974 from claudiubelu/hanging-task-delete-fix
task delete: Closes task IO before waiting
2021-09-15 11:30:23 -04:00
Phil Estes
40c7d1d168
Merge pull request #5985 from AkihiroSuda/crun-1.0
CI: bump up crun to 1.0
2021-09-15 10:24:48 -04:00
Kohei Tokunaga
6875aa5d37 import: Add option to skip creating digest image
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-15 20:20:57 +09:00
Fu Wei
da6b0efccd
Merge pull request #5982 from AkihiroSuda/clone3 2021-09-15 14:27:47 +08:00
Akihiro Suda
f700ae8732
CI: bump up crun to 1.0
Release notes: https://github.com/containers/crun/releases

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-09-15 14:45:06 +09:00
Akihiro Suda
55923daa9f
seccomp: support "clone3" (return ENOSYS unless SYS_ADMIN is granted)
clone3 is explicitly requested to give ENOSYS instead of the default EPERM, when CAP_SYS_ADMIN is unset.
See moby/moby PR 42681 (thanks to berrange).

Without this commit, rawhide image does not work:
```console
$ sudo ctr run --rm --net-host --seccomp registry.fedoraproject.org/fedora:rawhide foo /usr/bin/curl google.com
curl: (6) getaddrinfo() thread failed to start
```

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-09-15 14:44:45 +09:00
wssccc
8596d11886 Fix typo
Signed-off-by: Ng Yang <wssccc@qq.com>
2021-09-15 03:13:25 +00:00
Akihiro Suda
493220b719
Merge pull request #5990 from estesp/update-go-1.17.1
Update to Go 1.17.1
2021-09-15 03:52:28 +09:00
Phil Estes
73dbbf5bfa
Update to Go 1.17.1
Signed-off-by: Phil Estes <estesp@amazon.com>
2021-09-14 09:12:00 -04:00
Akihiro Suda
cbf9d88c9e
Merge pull request #5987 from wllenyj/ci
CI: Switch to available latest images
2021-09-14 22:10:52 +09:00
Zilong Wang
498e5b27f7 fix error string format
Signed-off-by: zilong.wang <zilong.wang@daocloud.io>
2021-09-14 18:17:27 +08:00
wllenyj
6d961f9673 CI: Switch to available latest images
`mirror.gcr.io/library/busybox:1.32` is unavailable.

```console
$ curl -s https://mirror.gcr.io//v2/library/busybox/tags/list | jq '.tags'
[
      "1.26.2",
      "1.27.2",
      "1.28",
      "1.29",
      "1.29.2",
      "1.29.3",
      "1.30",
      "1.30.1",
      "1.31",
      "1.31.0",
      "1.31.1",
      "1.32.0"
]
```

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
2021-09-14 11:59:19 +08:00
Phil Estes
8493cd1a50
Merge pull request #5610 from alakesh/xfs-support-devmapper
add xfs support to devicemapper snapshotter
2021-09-13 15:20:29 -04:00
Claudiu Belu
e087b47e98 import: Raise error if the imported image is filtered out
During import, if an image does not match the host's platform,
it won't have any children labels set, which will result in the
Garbage Collector deleting its content later, resulting in an
unusable image. In this case, we should fail early.

This can still be bypassed by using ctr import --all-platforms.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-13 11:19:48 -07:00
Phil Estes
8cf06feac4
Merge pull request #5956 from claudiubelu/windows/fixes-task-delete-force
Fixes task kill --force on Windows
2021-09-13 10:26:00 -04:00