Commit Graph

146 Commits

Author SHA1 Message Date
Derek McGowan
98b7dfb870
Merge pull request #8673 from thaJeztah/no_any
avoid "any" as variable name
2023-06-10 20:44:30 -07:00
Sebastiaan van Stijn
4bb709c018
avoid "any" as variable name
Avoid shadowing / confusion with Go's "any" built-in type.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-10 13:49:06 +02:00
Sebastiaan van Stijn
577696f608
replace some basic uses of fmt.Sprintf()
Really tiny gains here, and doesn't significantly impact readability:

    BenchmarkSprintf
    BenchmarkSprintf-10    11528700     91.59 ns/op   32 B/op  1 allocs/op
    BenchmarkConcat
    BenchmarkConcat-10    100000000     11.76 ns/op    0 B/op  0 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-06-10 13:24:43 +02:00
Laura Brehm
34a93a0c2c task: don't close() io before cancel()
The contract for `cio/io.go/IO` states that a call to `Close()`
will always be preceded by a call to `Cancel()` -
f3a07934b4/cio/io.go (L59)
which isn't being held up here.

Furthermore, the call to `Close()` here makes the subsequent `Wait()`
moot, and causes issues to consumers (see: https://github.com/moby/moby/issues/45689)

It seems from
f3a07934b4/task.go (L338)
that the `Close()` should be called there, the call removed in this
commit is unnecessary/erroneous.

We leave the `Close()` call on Windows only since this was introduced
in https://github.com/containerd/containerd/pull/5974 to address
https://github.com/containerd/containerd/issues/5621.

Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-06-06 11:03:35 +01:00
Iceber Gu
97064b0772 WithRuntimePath uses the TaskInfo.RuntimePath field
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-03-29 11:34:50 +08:00
Maksym Pavlenko
07c2ae12e1 Remove v1 runctypes
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2023-03-15 09:18:16 -07:00
Akihiro Suda
b61988670c
go.mod: github.com/containerd/typeurl/v2 v2.1.0
Changes: https://github.com/containerd/typeurl/compare/7f6e6d160d67...v2.1.0

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-11 23:39:52 +09:00
Gavin Inglis
80839f11e2 allow client to remove created tasks with PID 0
Fixes #7357

If a container is restored from a checkpoint that has a configuration
error, the task for the restored container is created, but fails to
start and is left in the state CREATED with a PID of 0. Before this
change, the only way to remove this task was to find the PID of the shim
monitoring the task and kill that process. Now, ctr t rm <task> will
work on tasks that result in the CREATED state with PID 0.

Signed-off-by: Gavin Inglis <giinglis@amazon.com>
2022-12-08 22:04:24 +00:00
Kazuyoshi Kato
1a095e18ba Rename Size_ to Size
Previouslty "Size" was reserved by protoc-gen-gogoctrd and user-generated
"Size" was automatically renamed to "Size_" to avoid conflicts.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-22 15:31:53 +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
Kazuyoshi Kato
80b825ca2c Remove gogoproto.stdtime
This commit removes gogoproto.stdtime, since it is not supported by
Google's official toolchain
(see https://github.com/containerd/containerd/issues/6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-04-19 13:39:30 +00: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
Kazuyoshi Kato
3eeeb9429a Remove gogoproto.customtype
gogoproto.customtype is used to have go-digest.Digest instead of string.
While it is convinient, protoc-gen-go doesn't support the extension
and that blocks #6564.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-18 23:14:44 +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
Claudiu Belu
55faa5e93d task delete: Closes task IO before waiting
After containerd restarts, it will try to recover its sandboxes,
containers, and images. If it detects a task in the Created or
Stopped state, it will be removed. This will cause the containerd
process it hang on Windows on the t.io.Wait() call.

Calling t.io.Close() beforehand will solve this issue.

Additionally, the same issue occurs when trying to stopp a sandbox
after containerd restarts. This will solve that case as well.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-07 02:17:01 -07:00
Wei Fu
72b7f4bab1 task: allow checkpoint on pause state
task.Checkpoint should check status of container before handle
checkpoint. If the container has been paused, task.Checkpoint should
handle checkpoint and leave it paused.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
Signed-off-by: Baijia <baijia.wr@antfin.com>
2021-03-24 16:37:39 +08:00
Kathryn Baldauf
95ba6e9f75 Add annotations to task update request api
Signed-off-by: Kathryn Baldauf <kabaldau@microsoft.com>
2020-11-09 14:13:33 -08:00
Michael Crosby
4318f93f9c Add Spec() method to task
Signed-off-by: Michael Crosby <michael@thepasture.io>
2020-07-27 21:32:15 -04:00
hs0210
87e2a95951 Fix a typo in task.go
Signed-off-by: Hu Shuai <hus.fnst@cn.fujitsu.com>
2019-12-30 13:40:33 +08:00
Michael Crosby
9b882c44f8
Merge pull request #3000 from stefanberger/descriptor_annotations.pr
Add missing annotations map to Descriptor for gRPC transfer
2019-03-22 14:05:44 -04:00
Michael Crosby
388c8a1760 Fastpath opt and ExecProcess loading
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-03-22 12:08:43 -04:00
Michael Crosby
aaae81189a Update checkpoint opts with runtime handling
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-03-06 12:42:45 -05:00
Michael Crosby
160737d2c8 Fix no pivot and keyring opts
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-03-06 12:37:36 -05:00
Stefan Berger
0b711d616a Copy annotations around where necessary
Make sure that the newly added annotations are copied around appropriately.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
2019-03-06 12:26:23 -05:00
Michael Crosby
84a24711e8 Add runc.v2 multi-shim
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-02-21 11:09:46 -05:00
Lantao Liu
7bd8dcd0d3 Fix potential containerd panic.
Signed-off-by: Lantao Liu <lantaol@google.com>
2019-02-05 00:38:02 -08:00
Ace-Tang
d4ecb00f6f checkpoint: return empty image if checkpointPath exist
Signed-off-by: Ace-Tang <aceapril@126.com>
2018-12-20 14:48:44 +08:00
Ace-Tang
6593399e9f cr: support checkpoint/restore without image
support checkpoint without committing a checkpoint dir into a
checkpoint image and restore without untar image into checkpoint
directory. support for both v1 and v2 runtime

Signed-off-by: Ace-Tang <aceapril@126.com>
2018-11-29 10:19:39 +08:00
Derek McGowan
6875d3df3a
Always check exists on commit error
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-14 01:26:03 -07:00
Derek McGowan
d64d8a06d5
Use image constructor in client
Replace manual image struct creation with the image
constructor which is there to do just that.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-31 15:23:08 -07:00
Michael Crosby
17ab11a236 Fixes for runtimev2 and checkpoint restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-07-20 12:09:29 -04:00
Akihiro Suda
d88de4a34f content: change Writer/ReaderAt to take OCI
This change allows implementations to resolve the location of the actual data
using OCI descriptor fields such as MediaType.

No OCI descriptor field is written to the store.

No change on gRPC API.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-06-01 11:51:43 +09:00
Derek McGowan
43d0a5cb60
Pass in context to lease done function in client
Allows the client to choose the context to finish the lease.
This allows the client to switch contexts when the main context
used to the create the lease may have been cancelled.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-03-22 14:09:24 -07:00
Michael Crosby
9b9a0ac8ad Add task.ID() API
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-03-19 13:44:49 -04:00
Lantao Liu
4ac4fd0b6a Close io after task deletion to avoid race condition.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-02-26 22:12:59 +00:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Akihiro Suda
ee70879202 *: use narrower content interfaces
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-02-09 19:52:52 +09:00
Derek McGowan
b763777288
diff: rename differ to comparer
Remove combined interface and split implementations.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-01-26 16:32:09 -08:00
Daniel Nephin
a901091f7c Rename cio.Creation to cio.Creator
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-12-08 14:26:10 -05:00
Daniel Nephin
65665ab807 Always Cancel before Close
Document this contract.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-12-08 10:30:36 -05:00
Lantao Liu
a03fdabc14 Close FIFOs on failure.
Signed-off-by: Lantao Liu <lantaol@google.com>
2017-11-30 23:19:12 +00:00
yanxuean
d56b49dd7c provide client.WithLease to user
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-11-23 10:24:41 +08:00
Daniel Nephin
f74862a0dd Add structcheck, unused, and varcheck linters.
Warn on unused and dead code

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-21 11:14:37 -05:00
Daniel Nephin
298dabc6c2 Move io.go into cio package
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-11-17 17:04:45 -05:00
Jess Valarezo
1966f9f1b7 ctr: update task kill to take exec-id
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-13 10:47:15 -08:00
Derek McGowan
07885f1364
Updates lease creation to respect existing leases
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-07 12:54:22 -08:00
Derek McGowan
dce27d8c62
Remove client use of gc root label
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-07 12:54:22 -08:00
Derek McGowan
e13894bb7a
Add leases api
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-07 12:54:22 -08:00
Michael Crosby
5fd0415985 Add comments and fix common lint issues
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-20 13:19:14 -04:00
Michael Crosby
21c992a9c8 Reverse checkpoint url
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-10-18 14:58:28 -04:00