Commit Graph

8778 Commits

Author SHA1 Message Date
Kazuyoshi Kato
db6075fc24 snapshot/devmapper: log actual values to investigate #4965
This test has been flaky in GitHub Actions. This change logs the
values from devmapper to further investigate the issue.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-02-01 16:27:59 -08:00
Phil Estes
49c5c14879
Merge pull request #4906 from payall4u/bugfix/fix-open-shim-fifo
bugfix: change the flag of open log fifo to avoid containerd hang on syscall open
2021-02-01 09:01:38 -05:00
Sebastiaan van Stijn
7a468a3f3f
cio.copyIO: refactor to use cio.Close() (windows)
Use the existing `.Close()` method instead of implementing the same
logic in this function.

The defer sets `cios` to `nil` if an error occurred to preserve the
existing behavior.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-01 11:22:08 +01:00
Sebastiaan van Stijn
219fa3d0a5
cio.copyIO: fix pipes potentially not being closed (Windows)
The defer functions were checking the local variable, and would therefore
not be executed, as the function returned if an error occurred.

Perhaps best illustrated when renaming the local variables;

    if fifos.Stdin != "" {
        l, err1 := winio.ListenPipe(fifos.Stdin, nil)
        if err1 != nil {
            return nil, errors.Wrapf(err1, "failed to create stdin pipe %s", fifos.Stdin)
        }
        defer func(l net.Listener) {
            if err1 != nil {
                l.Close()
            }
        }(l)
        // ...
    }

    if fifos.Stdout != "" {
        l, err2 := winio.ListenPipe(fifos.Stdout, nil)
        if err2 != nil {
            return nil, errors.Wrapf(err2, "failed to create stdout pipe %s", fifos.Stdout)
        }
        defer func(l net.Listener) {
            if err2 != nil {
                l.Close()
            }
        }(l)
        // ....
    }

This patch changes the function to use a named return variable, and to use
a single `defer()` that closes all pipes.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-01 11:19:50 +01:00
Sebastiaan van Stijn
baf6c1d5e2
cio: openFifos() use named return variables to use in defer()
This change is mostly defensive; when checking for the returned
error, it's easy to make a mistake, and check for a "local" error,
not the actual returned error.

This patch changes the function to use a named return variable,
which is checked in the defer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-01 11:17:54 +01:00
Sebastiaan van Stijn
6a2d3990d1
cio: FIFOSet.Close() check if FIFOSet is nill to prevent NPE
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-01 11:17:51 +01:00
payall4u
957fa3379d change flag from RDONLY to RDWR and close the fifo correct
Signed-off-by: Zhiyu Li <payall4u@qq.com>
2021-01-31 19:00:42 +08:00
Phil Estes
19ee068f93
Merge pull request #4974 from adisky/update-protobuf
Update gogo/protobuf to v1.3.2
2021-01-28 10:32:47 -05:00
Aditi Sharma
1423e9199d Update gogo/protobuf to v1.3.2
bump version 1.3.2 for gogo/protobuf due to CVE-2021-3121 discovered
in gogo/protobuf version 1.3.1, CVE has been fixed in 1.3.2

Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
2021-01-28 12:57:50 +00:00
Phil Estes
cb6f665040
Merge pull request #4975 from thaJeztah/mod_tidy
Makefile: run "go mod tidy" when vendoring
2021-01-27 11:31:13 -05:00
Sebastiaan van Stijn
6c69cd55fb
Makefile: run "go mod tidy" when vendoring
`make vendor` did not do a `go mod tidy` after vendoring, whereas
CI does this as part of the vendor validation, causing CI to fail
if `make vendor` was used to update vendoring, without doing a
`go mod tidy` as well.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-27 16:17:50 +01:00
Phil Estes
c28533c7a4
Merge pull request #4972 from crosbymichael/exec-sync
remove exec sync debug contents from logs
2021-01-26 16:26:43 -05:00
Michael Crosby
591d7e2fb1 remove exec sync debug contents from logs
This was dumping untrusted output to the debug logs from user containers.
We should not dump this type of information to reduce log sizes and any
information leaks from user containers.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-01-26 14:57:54 -05:00
Maksym Pavlenko
c28e424419
Merge pull request #4922 from kinvolk/alban_pod_annotations
cri: add annotations for pod name and namespace
2021-01-26 10:57:34 -08:00
Alban Crequy
28e4fb25f4 cri: add annotations for pod name and namespace
cri-o has annotations for pod name, namespace and container name:
https://github.com/containers/podman/blob/master/pkg/annotations/annotations.go

But so far containerd had only the container name.

This patch will be useful for seccomp agents to have a different
behaviour depending on the pod (see runtime-spec PR 1074 and runc PR
2682). This should simplify the code in:
b2d423695d/pkg/kuberesolver/kuberesolver.go (L16-L27)

Signed-off-by: Alban Crequy <alban@kinvolk.io>
2021-01-26 12:10:39 +01:00
Akihiro Suda
20346607b9
Merge pull request #4701 from kzys/content-store-filter 2021-01-25 22:35:45 +09:00
Derek McGowan
f615c58dcc
Merge pull request #4682 from fuweid/cri-handle-exit-event-separate
cri: handle sandbox/container exit event in parallel
2021-01-23 23:22:28 -08:00
Wei Fu
3299c5560d
Merge pull request #4967 from dmcgowan/cleanup-root
Move documentation and helper directories out of root
2021-01-24 15:08:19 +08:00
Maksym Pavlenko
9108373cbc
Merge pull request #4968 from dmcgowan/add-prune-references 2021-01-23 22:14:09 -08:00
Wei Fu
e56de63099 cri: handle sandbox/container exit event separately
The event monitor handles exit events one by one. If there is something
wrong about deleting task, it will slow down the terminating Pods. In
order to reduce the impact, the exit event watcher should handle exit
event separately. If it failed, the watcher should put it into backoff
queue and retry it.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-01-24 13:43:38 +08:00
Derek McGowan
9aca94c5b0
Add prune command to remove layer references
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-01-23 10:52:24 -08:00
Maksym Pavlenko
643bb9b66d
Merge pull request #4958 from AkihiroSuda/crun-017 2021-01-22 16:05:19 -08:00
Derek McGowan
aae24ecbce
Merge pull request #4963 from zhsj/move-runtimeopt
Move runtimeoptions out of cri package
2021-01-22 11:43:08 -08:00
Derek McGowan
9e78a001b9
Merge pull request #4964 from zhsj/cgo
Add cgo tag to btrfs plugin
2021-01-22 11:42:01 -08:00
Shengjing Zhu
074873c68e Add cgo tag to btrfs plugin
btrfs plugin needs CGO support. However on riscv64, cgo
is only support on go1.16 (not released yet).
Instead of setting no_btrfs manually, adding a cgo tag tells
the compiler to skip it automatically.

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2021-01-23 02:42:57 +08:00
Derek McGowan
5142c38421
Merge pull request #4960 from AkihiroSuda/eol-12
RELEASES.md: v1.2 reached EOL on October 15, 2020
2021-01-22 10:14:23 -08:00
Derek McGowan
0cd8309c89
Merge pull request #4959 from AkihiroSuda/go1.15.7
Bump Golang 1.15.7
2021-01-22 10:13:44 -08:00
Shengjing Zhu
2818fdebaa Move runtimeoptions out of cri package
Since it's a standard set of runtime opts, and used in ctr as well,
it could be moved out of cri.

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2021-01-23 01:24:35 +08:00
Akihiro Suda
d49e1d2393
RELEASES.md: v1.2 reached EOL on October 15, 2020
The file was not updated to reflect the current status.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-22 20:58:20 +09:00
Akihiro Suda
45265febd3
Bump Golang 1.15.7
Changes: https://golang.org/doc/devel/release.html#go1.15.minor

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-22 20:54:54 +09:00
Akihiro Suda
80243b8667
CI: update crun to 0.17
https://github.com/containers/crun/releases/tag/0.17

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-22 20:51:14 +09:00
Akihiro Suda
0bbbc59b97
Merge pull request #4957 from thaJeztah/update_seccomp_profile
profiles: seccomp: update to Linux 5.11 syscall list
2021-01-22 18:22:23 +09:00
Derek McGowan
809635b602
Merge pull request #4759 from anmaxvl/anmaxvl/windows-logging-driver
Enhance logging driver to support windows
2021-01-21 22:37:28 -08:00
Derek McGowan
5a66c2ae5c
Merge pull request #4881 from AkihiroSuda/converter
add Image content converter
2021-01-21 22:24:54 -08:00
Akihiro Suda
5ca3ac65c4
add Image content converter
Go example:
```go
opts := []converter.Opt{
  // convert Docker media types to OCI ones
  converter.WithDocker2OCI(true),
  // convert tar.gz layers to uncompressed tar layers
  converter.WithLayerConvertFunc(uncompress.LayerConvertFunc),
}
srcRef := "example.com/foo:orig"
dstRef := "example.com/foo:converted"
dstImg, err = converter.Convert(ctx, client, dstRef, srcRef, opts...)
fmt.Println(dstImg.Target)
```

ctr example: `ctr images convert --oci --uncompress example.com/foo:orig example.com/foo:converted`

Go test: `go test -exec sudo -test.root -test.run TestConvert`

The implementation is from https://github.com/containerd/stargz-snapshotter/pull/224,
but eStargz-specific functions are not included in this PR.

eStargz converter can be specified by importing `estargz` package and using `WithLayerConvertFunc(estargz.LayerConvertFunc)` option.

This converter interface will be potentially useful for converting zstd and ocicrypt layers as well.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-22 13:33:19 +09:00
Derek McGowan
9b9de47eb9
Merge pull request #4824 from dcantah/dcantah/reuse-scratch
Add scratch space re-use functionality to LCOW snapshotter
2021-01-21 17:21:31 -08:00
Derek McGowan
392b2857aa
Merge pull request #4848 from katiewasnothere/ctr_image_chainid
Add a new flag to ctr "images pull" to print the image's chainID
2021-01-21 17:11:53 -08:00
Sebastiaan van Stijn
e1445dff12
profiles: seccomp: update to Linux 5.11 syscall list
These syscalls (some of which have been in Linux for a while but were
missing from the profile) fall into a few buckets:

 * close_range(2), epoll_wait2(2) are just extensions of existing "safe
   for everyone" syscalls.

 * The mountv2 API syscalls (fs*(2), move_mount(2), open_tree(2)) are
   all equivalent to aspects of mount(2) and thus go into the
   CAP_SYS_ADMIN category.

 * process_madvise(2) is similar to the other process_*(2) syscalls and
   thus goes in the CAP_SYS_PTRACE category.

Co-authored-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-21 21:30:25 +01:00
Maksim An
ddb5e1651a Enhance logging driver and ctr tasks to support windows
Signed-off-by: Maksim An <maksiman@microsoft.com>
2021-01-21 12:17:32 -08:00
Derek McGowan
83f8d6126b
Merge pull request #4925 from dmcgowan/prepare-1.5.0-beta.0
Add release notes for v1.5.0-beta.0
2021-01-21 09:21:53 -08:00
Derek McGowan
c4bff3d17c
Merge pull request #4943 from AkihiroSuda/platforms-literallyonly
platforms: add subarchless version of Only()
2021-01-20 17:27:43 -08:00
Derek McGowan
7d6d526462
Add release notes for v1.5.0-beta.0
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-01-20 10:45:16 -08:00
Phil Estes
c35b4cfed5
Merge pull request #4955 from adisky/fix-doc
Clean Up Doc and fix some broken links
2021-01-20 08:46:17 -05:00
Aditi Sharma
d09bf18862 Clean Up Doc and fix some broken links
Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
2021-01-20 15:45:43 +05:30
Phil Estes
1230bd6303
Merge pull request #4952 from crosbymichael/label-etc-files
[cri] label etc files for selinux containers
2021-01-19 16:21:35 -05:00
Maksym Pavlenko
9c3f171391
Merge pull request #4953 from ImJasonH/cpuinfo
Derive cpuinfo as needed, instead of at init-time
2021-01-19 13:16:30 -08:00
Jason Hall
363f2c392c Derive cpuinfo as needed, instead of at init-time
This changes platforms.Parse to hit /proc to look up CPU info only when
it's needed, instead of in init(). This makes the package a bit easier
for other packages to consume, especially clients that don't call
platforms.Parse or need to lookup CPU info.

Signed-off-by: Jason Hall <jasonhall@redhat.com>
2021-01-19 14:10:39 -05:00
Michael Crosby
a731039238 [cri] label etc files for selinux containers
Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-01-19 13:42:09 -05:00
Daniel Canter
ff1451cab8 Scratch size customization and UVM scratch creation for WCOW snapshotter
* Currently we rely on making the UVMs sandbox.vhdx in the shim itself instead of this being
made by the snapshotter itself. This change adds a label that affects whether to create the UVMs
scratch layer in the snapshotter itself.

* Adds container scratch size customization. Before adding the computestorage calls
(vendored in with https://github.com/containerd/containerd/pull/4859) there was no way to make a containers
or UVMs scratch size less than the default (20 for containers and 10 for the UVM).

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-01-18 07:33:52 -08:00
Akihiro Suda
e22ce0fa03
platforms: add subarchless version of Only()
`OnlyStrict()` returns a match comparer for a single platform.

Unlike `Only()`, `OnlyStrict()` does not match sub platforms.
So, "arm/vN" will not match "arm/vM" where M < N, and "amd64" will not also match "386".

`OnlyStrict()` matches non-canonical forms. So, "arm64" matches "arm/64/v8".

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-15 14:58:14 +09:00