Commit Graph

1259 Commits

Author SHA1 Message Date
Eric Ernst
52593cfc86 containerd-stress: add support for running through CRI
Introduce a --cri flag, which will enable running container-stress using the CRI,
instead of containerd's task API.

In doing so, we introduce cri_worker, rename the existing worker to ctr_worker, and introduce
a worker interface that each of these implement.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-06-11 09:59:07 +02:00
Maksym Pavlenko
c101f79996 Allow CRI on Darwin
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-06-09 10:13:00 -07:00
Derek McGowan
8ba075c3dd
Merge pull request #6954 from Iceber/fix_ctr_new_container
ctr: fix label args used in NewContainer
2022-05-25 09:01:32 -07:00
Derek McGowan
928ae45e39
Merge pull request #6959 from mythi/ctr-sb
ctr sandbox: handle sandbox config
2022-05-24 18:25:31 -07:00
Kazuyoshi Kato
868c7c3fa8
Merge pull request #6956 from my-git9/mygit2
adjust format in comment
2022-05-19 14:44:12 -07:00
Mikko Ylinen
900019b301 ctr sandbox: handle sandbox config
"ctr s r" help suggests <pod-config.json> is taken as the first
parameter and the sandbox ID becomes next. However, only the latter
is read and used.

Add code that reads <pod-config.json> and passes it to Sanbox.

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-05-19 15:28:49 +03:00
xin.li
8ec1fc70d9 adjust format
Signed-off-by: xin.li <xin.li@daocloud.io>
2022-05-19 17:31:26 +08:00
xin.li
8494f7f117 adjust format in comment
Signed-off-by: xin.li <xin.li@daocloud.io>
2022-05-19 00:24:56 +08:00
Iceber Gu
92b7bc9edc ctr: fix label args used in NewContainer
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2022-05-18 16:11:30 +08:00
Gavin Inglis
2c98a7b099 ctr import: strictly match platform
Currently, ctr import will use loose matching as defined by
platforms.Only(), meaning in the case of platform linux/amd64 as in
issue#6441, importing will also match linux/386 platform on the
image-to-be-imported's index. However, that image-to-be-imported may not
have both the linux/amd64 and linux/386 platform contents, resulting in
a failure to unpack the image. This change makes that check strict such
that the requested platform to import for is the only platform content
imported. Both ctr pull and ctr export will treat the platform option as
strict, so this change makes ctr import consistent with those.

resolves #6441

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
2022-05-06 22:44:43 +00:00
Akihiro Suda
42584167b7
Officially deprecate Schema 1
Schema 1 has been substantially deprecated since circa. 2017 in favor of Schema 2 introduced in Docker 1.10 (Feb 2016)
and its successor OCI Image Spec v1, but we have not officially deprecated Schema 1.

One of the reasons was that Quay did not support Schema 2 so far, but it is reported that Quay has been
supporting Schema 2 since Feb 2020 (moby/buildkit issue 409).

This PR deprecates pulling Schema 1 images but the feature will not be removed before containerd 2.0.
Pushing Schema 1 images was never implemented in containerd (and its consumers such as BuildKit).

Docker/Moby already disabled pushing Schema 1 images in Docker 20.10 (moby/moby PR 41295),
but Docker/Moby has not yet disabled pulling Schema 1 as containerd has not yet deprecated Schema 1.
(See the comments in moby/moby PR 42300.)
Docker/Moby is expected to disable pulling Schema 1 images in future after this deprecation.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-05-02 19:08:38 +09:00
Phil Estes
65627f568f
Merge pull request #6809 from jterry75/main
Add ctr support for CPUMax and CPUShares
2022-04-29 16:39:52 +01:00
Mike Brown
6b35307594
Merge pull request #5490 from askervin/5Bu_blockio
Support for cgroups blockio
2022-04-29 10:07:56 -05:00
Antti Kervinen
10576c298e cri: support blockio class in pod and container annotations
This patch adds support for a container annotation and two separate
pod annotations for controlling the blockio class of containers.

The container annotation can be used by a CRI client:
  "io.kubernetes.cri.blockio-class"

Pod annotations specify the blockio class in the K8s pod spec level:
  "blockio.resources.beta.kubernetes.io/pod"
  (pod-wide default for all containers within)

  "blockio.resources.beta.kubernetes.io/container.<container_name>"
  (container-specific overrides)

Correspondingly, this patch adds support for --blockio-class and
--blockio-config-file to ctr, too.

This implementation follows the resource class annotation pattern
introduced in RDT and merged in commit 893701220.

Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
2022-04-29 11:44:09 +03:00
Justin Terry
227156dac6 Add ctr support for CPUMax and CPUShares
Adds CPU.Maximum and CPU.Shares support to the ctr
cmdline for testing

Signed-off-by: Justin Terry <jlterry@amazon.com>
2022-04-28 13:17:16 -07:00
Kazuyoshi Kato
fd37cc75be Use protoc-gen-go instead of protoc-gen-gogoctrd
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-22 15:31:53 +00:00
Kazuyoshi Kato
aa1526defc Use proto.Marshal instead of calling Marshal() on objects
With google.golang.org/protobuf, proto-generated objects only have
ProtoReflect(). They don't have Marshal() anymore (see #6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-20 17:14:24 +00:00
Kazuyoshi Kato
237ef0de9b Remove all gogoproto extensions
This commit removes the following gogoproto extensions;

- gogoproto.nullable
- gogoproto.customename
- gogoproto.unmarshaller_all
- gogoproto.stringer_all
- gogoproto.sizer_all
- gogoproto.marshaler_all
- gogoproto.goproto_unregonized_all
- gogoproto.goproto_stringer_all
- gogoproto.goproto_getters_all

None of them are supported by Google's toolchain (see #6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-20 07:23:28 +00:00
Fu Wei
fe7f0aeef4
Merge pull request #6827 from mxpv/renames 2022-04-20 14:06:29 +08:00
Maksym Pavlenko
e2fd25f3d8 Move runtime v2 proto
Move runtime v2 protos to api/runtime package.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-19 17:59:33 -07:00
Kazuyoshi Kato
3742c756e8 Don't generate a Go file, if that would be empty
Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-19 22:15:45 +00:00
Kazuyoshi Kato
5f3b724323 Fix protoc-gen-go-fieldpath
The generator has to handle nested fields such as
902212651b/api/events/container.proto (L31-L35).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-19 22:11:03 +00:00
Kazuyoshi Kato
88c0c7201e Consolidate gogo/protobuf dependencies under our own protobuf package
This would make gogo/protobuf migration easier.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-19 15:53:36 +00:00
Derek McGowan
be60973a30
Merge pull request #6703 from mxpv/s
Sandbox API
2022-04-18 20:55:06 -07:00
Derek McGowan
fe8da6dcaf
Move lease manager plugin to separate package
Create lease plugin type to separate lease manager from services plugin.
This allows other service plugins to depend on the lease manager.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-04-15 11:08:47 -07:00
Maksym Pavlenko
85a49e4ee7 [sandbox] Cleanup interfaces
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:34:50 -07:00
Maksym Pavlenko
0d165e6544 Restore sandboxes on daemon restart
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:48 -07:00
Maksym Pavlenko
fa02477ca9 [sandbox] Add sandbox shim skeleton
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:48 -07:00
Maksym Pavlenko
17a2aaded3 [sandbox] Add ctr support
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:48 -07:00
Maksym Pavlenko
eaccbf1d03 [sandbox] Add clients
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-08 13:33:47 -07:00
Kazuyoshi Kato
6fdaebde35
Merge pull request #6672 from linxiulei/fix_rel
Turn paths from cmdline into absolute paths
2022-04-06 09:20:10 -07:00
Maksym Pavlenko
0b2a95e107 Add no_tracing tag
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-03-31 14:37:11 -07:00
Eric Lin
44a8ac7b0c Turn paths from cmdline into absolute paths
Snapshotter service returning relative paths confuses the client (i.e.
ctr).

Closes: #6671

Signed-off-by: Eric Lin <linxiulei@gmail.com>
2022-03-27 17:25:44 +00:00
Phil Estes
3633cae64b
Merge pull request #6706 from kzys/typeurl-upgrade
Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
2022-03-25 10:38:46 -04:00
Fu Wei
595ad06de7
Merge pull request #6713 from cosmoer/fix-ctr-images-mount-command
fix: ctr images mount with snapshotter option can't get snapshotter
2022-03-25 07:37:04 +08:00
Kazuyoshi Kato
96b16b447d Use typeurl.Any instead of github.com/gogo/protobuf/types.Any
This commit upgrades github.com/containerd/typeurl to use typeurl.Any.
The interface hides gogo/protobuf/types.Any from containerd's Go client.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-24 20:50:07 +00:00
cosmoer
df93940fb2 fix: ctr images mount with snapshotter option can't get snapshotter
Signed-off-by: Qian Zhang <cosmoer@qq.com>
2022-03-23 23:12:54 +08:00
Sebastiaan van Stijn
d2013d2c99
runtime: deprecate runc --criu / -criu-path option
runc option --criu is now ignored (with a warning), and the option will be
removed entirely in a future release. Users who need a non- standard criu
binary should rely on the standard way of looking up binaries in $PATH.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-23 14:42:43 +01:00
Michael Crosby
de9344d845
Merge pull request #6670 from snbc/ctr_run_cni
fix: `ctr run --cni` get failed
2022-03-16 14:45:00 -04:00
Phil Estes
cf30a39353
Merge pull request #6562 from kzys/fieldpath
Add protoc-gen-go-fieldpath
2022-03-15 07:48:30 -07:00
songjiang han
2a0b2ee9eb fix: ctr run --cni get failed
when   user  executes ctr run --cni to start a container,it will call cni plugin to create network .But when user kills it,the network won’t be removed. if we run a container with same namespace and name again will trigger a bug. we should remove the network when user kills task if it enables cni plugin.

Fix:#6604

Signed-off-by: SongJiang Han <songjiang.dark@gmail.com>
2022-03-15 15:46:29 +08:00
Kazuyoshi Kato
50ca5727b2
Merge pull request #6519 from ginglis13/ctr-runtime-path
ctr: improve error relative shim path error msg
2022-03-14 09:49:27 -07:00
Tomoya.Fujita
ba1674389f typo fixes under cmd.
Signed-off-by: Tomoya.Fujita <Tomoya.Fujita@sony.com>
2022-03-12 11:32:31 -08:00
Paul "TBBle" Hampson
2a425990cf Implement --device idType://id for ctr run on Windows
Also fixes the issue that `ctr run` on Windows offered help for the
non-Windows implementation, but was silently ignored.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2022-03-12 08:16:43 +11:00
Phil Estes
b521429b67
Merge pull request #6495 from thaJeztah/improve_versions
strip path-info from `-v` (version) output, and implement -v flag for containerd-shim
2022-03-08 13:57:34 -05:00
Gavin Inglis
7b045ea5f0 ctr: improve error relative shim path error msg
addresses https://github.com/containerd/containerd/issues/6464

Return an error if a runtime provided is relative.

Add context to the usage for `ctr run --runtime` indicating that
absolute path to runtime binary must be provided.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
2022-03-03 23:28:03 +00:00
Justin Terry
0c79257f59 Add --user support for ctr run Windows
Adds the ability to override the default user
ContainerUser with a custom user if present in
the image or ContainerAdministrator if needed.

Signed-off-by: Justin Terry <jlterry@amazon.com>
2022-03-01 15:28:51 -08:00
Kazuyoshi Kato
3febabffeb Add protoc-gen-go-fieldpath
This command will replace protobuf/plugin/fieldpath when we migrate
off from gogo/protobuf.

See #6564 for the detail.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-02-21 17:36:12 +00:00
Eric Ernst
ac2692d30f containerd-stress: introduce option for specifying image
allow user to specify what image should be used for containerd-stress.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-06 09:55:16 -08:00
Eric Ernst
8b9571e348 containerd-stress: start task ctr before starting execs
For some runtimes, the container is not ready for exec until the
initial container task has been started (as opposed to just having the task created).

More specifically, running containerd-stress with --exec would break
with Kata Container shim, since the sandbox is not created until a
start is issued. By starting the container's primary task before adding
exec's, we can avoid:
```
error="cannot enter container exec-container-1, with err Sandbox not running, impossible to enter the container: unknown"
```

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-02-04 16:08:44 -08:00
Sebastiaan van Stijn
fdbfde5d81
cmd/containerd-shim: add -v (version) flag
Unlike the other shims, containerd-shim did not have a -v (version) flag:

    ./bin/containerd-shim-runc-v1 -v
    ./bin/containerd-shim-runc-v1:
    Version: v1.6.0-rc.1
    Revision: ad771115b82a70cfd8018d72ae489c707e63de16.m
    Go version: go1.17.2

    ./bin/containerd-shim -v
    flag provided but not defined: -v
    Usage of ./bin/containerd-shim:

This patch adds a `-v` flag to be consistent with the other shims. The code was
slightly refactored to match the implementation in the other shims, taking the
same approach as 77d53d2d23/runtime/v2/shim/shim.go (L240-L256)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-31 21:09:50 +01:00
Derek McGowan
62f6c8175a
Merge pull request #6424 from cpuguy83/nondist-blob-push
Add support for skipping non-dist blob push
2022-01-19 19:12:31 -08:00
ningmingxiao
ed0828bb6b
delete useless code
Signed-off-by: ningmingxiao <ning.mingxiao@zte.com.cn>
2022-01-18 21:10:20 +08:00
ning.a.li
a303d552ad ctr: Unify the delete subcommand alias
This commit unifies the following sub commands alias for
deleting/removing.
- containers
- tasks
- contents
- leases
- images
- snapshots

Signed-off-by: Ning Li <lining2020x@163.com>
2022-01-11 16:21:26 +08:00
Brian Goff
d05194f0a7 ctr: flag to toggle non-distributable blob push
With this flag, ctr will no longer automatically push non-distributable
artifacts by default.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2022-01-11 00:49:40 +00:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
Markus Lehtonen
9e755d12e2 cmd: add --rdt-class command line option
A new option for setting the RDT class (or CLOS) from the command line.

Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
2022-01-04 09:27:54 +02:00
Derek McGowan
bf60e2d174
Merge pull request #6304 from lippertmarkus/fix-ctr-cni-windows
fix(ctr): enable networking for Windows containers
2022-01-03 10:47:44 -08:00
Markus Lippert
f39b3ac7ea fix(ctr): enable networking for Windows containers
Signed-off-by: Markus Lippert <lippertmarkus@gmx.de>
2021-12-21 07:13:39 +01:00
Kazuyoshi Kato
2ee3ce510c Use insecure.NewCredentials instead of grpc.WithInsecure
grpc.WithInsecure is being deprecated.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-16 23:10:06 +00:00
Phil Estes
330961c2d5
Merge pull request #6358 from jonyhy96/feat-error
refactor: functions for error log and error return
2021-12-14 10:16:54 -05:00
Fu Wei
d47fa40d1b
Merge pull request #6021 from dmcgowan/runc-shim-plugin 2021-12-14 10:19:23 +08:00
Derek McGowan
f83ab813d2
Use task plugin for runc shim
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-12-13 10:37:13 -08:00
haoyun
c0d07094be feat: Errorf usage
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-13 14:31:53 +08:00
Maksym Pavlenko
d2f1dda0f1 Include runtime v2 in default builtins
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-12-03 11:30:03 -08:00
Maksym Pavlenko
9e7910ebdc
Merge pull request #6271 from fuweid/move_stdout_to_stderr
ctr/snapshots/diff: show media-type in stderr
2021-11-28 11:29:21 -08:00
Wei Fu
6681cc4b94 ctr/snapshots/diff: don't show the media-type in output
By default, diff subcommand will print tar(.gz) on stdout. If we print
the media-type in stdout, the output will create invalid tar(.gz) data.

```
// before
➜  containerd git:(move_stdout_to_stderr) sudo ctr snapshot diff sha256:9f54eef412758095c8079ac465d494a2872e02e90bf1fb5f12a1641c0d1bb78b > /tmp/1.tar
➜  containerd git:(move_stdout_to_stderr) file /tmp/1.tar
/tmp/1.tar: data

// after change
➜  containerd git:(move_stdout_to_stderr) make bin/ctr
+ bin/ctr
➜  containerd git:(move_stdout_to_stderr) sudo bin/ctr snapshot diff sha256:9f54eef412758095c8079ac465d494a2872e02e90bf1fb5f12a1641c0d1bb78b > /tmp/2.tar

➜  containerd git:(move_stdout_to_stderr) file /tmp/2.tar
/tmp/2.tar: gzip compressed data, original size modulo 2^32 75155456
```

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2021-11-28 10:38:42 +08:00
Manabu Sugimoto
95b3ab2a4a ctr: Add Linux Capabilities control flags
This allows Linux Capabilities to be modified via `ctr`.

e.g.
```
$ sudo ./bin/ctr run --cap-add "CAP_SYS_ADMIN" --cap-drop "CAP_NET_RAW" \
--rm docker.io/library/busybox:latest foo cat /proc/self/status | grep Cap
CapInh: 00000000a82405fb
CapPrm: 00000000a82405fb
CapEff: 00000000a82405fb
CapBnd: 00000000a82405fb
CapAmb: 0000000000000000
```

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2021-11-25 14:50:43 +09:00
haoyun
fa6759ae53 fix: server error return
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-11-22 13:54:53 +08:00
botieking98
3e51312a61 fix shim reaper wait command execute blocked
wait no timeout will lead to event publish
process hang in some special scenarios.

Signed-off-by: botieking98 <botieking@gmail.com>
2021-10-27 15:20:03 +08:00
Claudiu Belu
5b222d54ad commands: Enables task metrics for Windows
The command already contains logic for Windows container
metrics, we just need to enable the command.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-10-05 09:25:12 -07:00
Sambhav Kothari
2a8dac12a7 Output a warning for label image labels instead of erroring
This change ignore errors during container runtime due to large
image labels and instead outputs warning. This is necessary as certain
image building tools like buildpacks may have large labels in the images
which need not be passed to the container.

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2021-10-14 19:25:48 +01:00
Michael Crosby
e48bbe8394 add runc shim support for sched core
In linux 5.14 and hopefully some backports, core scheduling allows processes to
be co scheduled within the same domain on SMT enabled systems.

The containerd impl sets the core sched domain when launching a shim. This
allows a clean way for each shim(container/pod) to be in its own domain and any
additional containers, (v2 pods) be be launched with the same domain as well as
any exec'd process added to the container.

kernel docs: https://www.kernel.org/doc/html/latest/admin-guide/hw-vuln/core-scheduling.html

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-10-08 16:18:09 +00:00
Derek McGowan
63b7e5771e
Merge pull request #5973 from Juneezee/deprecate-ioutil
refactor: move from io/ioutil to io and os package
2021-10-01 10:52:06 -07:00
jonyhy
933ddaa6f8 fix: wrong flag type
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-29 16:22:51 +08:00
jonyhy
da16d492cd feat: support import image for specific platform
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-29 14:00:17 +08:00
jonyhy
e6ddffc2af fix: make exec-id flag required in exec command
Signed-off-by: jonyhy <yun.hao@daocloud.io>
2021-09-28 18:19:32 +08:00
Kohei Tokunaga
2244540628 Fix main branch build is broken
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-25 11:48:14 +09:00
Derek McGowan
22beecb7d9
Merge pull request #6003 from cpuguy83/add_otel_log_hook
Add open telemetry logging hook for logrus
2021-09-24 17:21:46 -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
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
Kaijie Chen
16d3f48a2e ctr namespaces: improve usage string
Signed-off-by: Kaijie Chen <chen@kaijie.org>
2021-09-21 12:26:29 +08: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
Fu Wei
7ddf5e52ba
Merge pull request #6012 from estesp/set-image-labels 2021-09-16 14:50:10 +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
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
d9f921e4f0
Merge pull request #5906 from thaJeztah/replace_os_exec 2021-09-11 10:38:53 +08:00
Michael Crosby
6bec0d39b0
use a const metric for build_info
Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-09-09 12:20:14 -04:00
Nicolas Chariglione
ae27a6b05c Add metric exposing build version&revision
Signed-off-by: Nicolas Chariglione <nicolas.chariglione@gmail.com>
2021-09-09 11:59:22 -04:00
Daniel Canter
27046a9e06 Fix cwd flag for ctr tasks exec
It seems like the cwd flag isn't used anywhere for ctr tasks exec. This change
just sets the cwd field on the spec for the execed process if a new one was
asked for, otherwise it will continue using whatever was on the containers spec.

Signed-off-by: Daniel Canter <dcanter@microsoft.com>
2021-09-02 03:59:56 -07:00
Sebastiaan van Stijn
2ac9968401
replace uses of os/exec with golang.org/x/sys/execabs
Go 1.15.7 contained a security fix for CVE-2021-3115, which allowed arbitrary
code to be executed at build time when using cgo on Windows. This issue also
affects Unix users who have “.” listed explicitly in their PATH and are running
“go get” outside of a module or with module mode disabled.

This issue is not limited to the go command itself, and can also affect binaries
that use `os.Command`, `os.LookPath`, etc.

From the related blogpost (ttps://blog.golang.org/path-security):

> Are your own programs affected?
>
> If you use exec.LookPath or exec.Command in your own programs, you only need to
> be concerned if you (or your users) run your program in a directory with untrusted
> contents. If so, then a subprocess could be started using an executable from dot
> instead of from a system directory. (Again, using an executable from dot happens
> always on Windows and only with uncommon PATH settings on Unix.)
>
> If you are concerned, then we’ve published the more restricted variant of os/exec
> as golang.org/x/sys/execabs. You can use it in your program by simply replacing

This patch replaces all uses of `os/exec` with `golang.org/x/sys/execabs`. While
some uses of `os/exec` should not be problematic (e.g. part of tests), it is
probably good to be consistent, in case code gets moved around.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-25 18:11:09 +02:00
Akihiro Suda
d3aa7ee9f0
Run go fmt with Go 1.17
The new `go fmt` adds `//go:build` lines (https://golang.org/doc/go1.17#tools).

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-08-22 09:31:50 +09:00
Michael Crosby
6f60b3016f [ctr] add HOSTNAME env for host network
Set the hostname environment var when using host networking via ctr

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-08-18 14:42:36 +00:00
Fu Wei
1c4e9d0487
Merge pull request #5846 from crosbymichael/ctr-cpu.shares 2021-08-11 09:24:00 +08:00
Michael Crosby
d2f3b71468 add cpu-shares to ctr
This allows the cpu shares to be modified via ctr.

Signed-off-by: Michael Crosby <michael@thepasture.io>
2021-08-10 04:12:15 -04:00
Michael Crosby
218db0f9af
Merge pull request #5835 from dmcgowan/plugin-events-cleanup
Move plugin context events into separate plugin
2021-08-07 21:47:11 -04:00
Derek McGowan
0a0621bb47
Move plugin context events into separate plugin
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-08-05 22:59:20 -07:00
Derek McGowan
6f027e38a8
Remove redundant build tags
Remove build tags which are already implied by the name of the file.
Ensures build tags are used consistently

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-08-05 22:27:46 -07:00