Commit Graph

185 Commits

Author SHA1 Message Date
Maksym Pavlenko
ca3b9b50fe Run gofmt 1.19
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-08-04 18:18:33 -07:00
Kazuyoshi Kato
e9e33f847d Copy fuzzers from github.com/cncf/cncf-fuzzing
This commit copies the fuzzers from the repository except for
containerd_import_structured_fuzzer.go.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-07-06 15:21:48 +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
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
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
Maksym Pavlenko
871b6b6a9f Use testify
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-04-01 18:17:58 -07:00
Kazuyoshi Kato
067611fdea Remove enumvalue_customname, goproto_enum_prefix and enum_customname
This commit removes gogoproto.enumvalue_customname,
gogoproto.goproto_enum_prefix and gogoproto.enum_customname.

All of them make proto-generated Go code more idiomatic, but we already
don't use these enums in our external-surfacing types and they are anyway
not supported by Google's official toolchain (see #6564).

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2022-03-21 19:48:16 +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
Fu Wei
79d7df70d6
Merge pull request #6681 from Juneezee/test/t.TempDir 2022-03-16 14:54:16 +08:00
Eng Zer Jun
18ec2761c0
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-03-15 14:03:50 +08:00
Henry Wang
2e080bf491 Add shared content label to namespaces
Signed-off-by: Henry Wang <henwang@amazon.com>
2022-03-11 23:37:02 -08:00
Derek McGowan
48c7529de2
Fix incorrect error wrapped when closing ingest file
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-07 12:23:18 -08:00
Derek McGowan
0c2c289d4c
Fix seek error used without nil check
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-01-07 12:19:23 -08: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
Tobias Klauser
df21828d27
content/local: use syscall.Timespec.Unix
Use the syscall method instead of repeating the type conversions for
the syscall.Stat_t Atim/Atimespec members. This also allows to drop the
//nolint: unconvert comments.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2022-01-03 12:37:25 +01:00
haoyun
c0d07094be feat: Errorf usage
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-13 14:31:53 +08:00
Shiming Zhang
9dfbcbbc48 content/local: Close the file if Seek fails
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-11-23 16:18:13 +08:00
zounengren
46be069379 close Writer after use which may leak mem
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2021-10-12 17:25:08 +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
Derek McGowan
2458afeb13
Fix content copy to not ignore unexpected EOF
Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-09-09 10:01:51 -07: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
Kazuyoshi Kato
a3d6edc0ed content: return the error with its timestamp
The current timestamp is probably included in production logs, but
won't be in testing environments such as GitHub Actions.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-08-09 16:52:40 -07:00
Sebastiaan van Stijn
63c185da9a
content/local: inline sys.StatATimeAsTime()
The sys.StatATimeAsTime() utility is currently only used in a single place,
but because it's living in the "sys" package, also brings in other dependencies,
such as Microsoft/hcsshim.

This patch inlines the code from sys.StatATimeAsTime(), to remove that dependency.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-22 10:14:29 +02:00
Phil Estes
edfd8d5993
Change Wrapf of non-error to an actual error
Signed-off-by: Phil Estes <estesp@amazon.com>
2021-06-02 14:48:49 -04:00
Shiming Zhang
9fcea1d3f0 Rename atomicWrite to writeToCompletion
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-05-27 18:07:45 +08:00
Shiming Zhang
b890f056e8 Fix content.ReaderAt close
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-05-08 12:39:09 +08:00
Furkan
7d70992d33
tests: add test for adaptor
I noticed AdaptInfo missing test cases. I think this
func a bit important to test since we use this func
in other packages like content, store (walking), etc.

Signed-off-by: Furkan Turkal <furkan.turkal@trendyol.com>
Signed-off-by: Furkan <furkan.turkal@trendyol.com>
2021-05-05 17:39:39 +03:00
Shiming Zhang
9e576b8891 Optimize backoff
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-04-15 23:25:09 +08:00
Tonis Tiigi
8d8c15ca53 contentproxy: ensure grpc stream is closed on commit
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-03-18 22:46:49 -07:00
Derek McGowan
35eeb24a17
Fix exported comments enforcer in CI
Add comments where missing and fix incorrect comments

Signed-off-by: Derek McGowan <derek@mcg.dev>
2021-03-12 08:47:05 -08:00
Maksym Pavlenko
571cc32df6 Add OpenReader to create ReaderAt interface
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2021-03-08 12:04:58 -08:00
Akihiro Suda
20346607b9
Merge pull request #4701 from kzys/content-store-filter 2021-01-25 22:35:45 +09:00
Muhammad Kaisar Arkhan
380b52652c Bring OpenBSD support
Signed-off-by: Muhammad Kaisar Arkhan <hi@yukiisbo.red>
2021-01-04 14:43:48 +01:00
Kazuyoshi Kato
c95d71cf60 content: include the staleness of the lock when tryLock() fails
When multiple clients are pulling the same image, we may have this
lock error. Short-lived locks are probably fine, but long-lived locks
may indicate that containerd has some issues.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2020-12-02 14:08:02 -08:00
Kazuyoshi Kato
e74ace9ad8 content: support filters on local.store#Walk()
While Walk() has been taking filter strings, it was not using the parameter.
This change actually makes the filtering work.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2020-11-11 11:17:48 -08:00
Amr Mahdi
b81917ee72 Add comments clarifying copyWithBuffer implementation
Signed-off-by: Amr Mahdi <amramahdi@gmail.com>
2020-11-03 04:25:42 +00:00
Amr Mahdi
f6834d4c0b replicate io.Copy optimizations
Signed-off-by: Amr Mahdi <amramahdi@gmail.com>
2020-10-28 05:50:14 +00:00
Amr Mahdi
289130b8a7 Improve image pull performance from http 1.1 container registries
Private registries that does not support http 2.0 such as Azure Container Registry streams back content in a max of 16KB chunks (max TLS record size). The small chunks introduce an overhead when copying the layers to the content store sine each chunk incurs the overhead of  grpc message that has to be sent to the content store.

This change reduces this overhead by buffering the chunks into 1MB chunks and only then writes a message to the content store.

Below is a per comparsion between the 2 approaches using a couple of large images that are being pulled from the docker hub (http 2.0) and a private Azure CR (http 1.1) in seconds.

image                                                   | Buffered copy | master
-------                                                 |---------------|----------
docker.io/pytorch/pytorch:latest                        |  55.63        | 58.33
docker.io/nvidia/cuda:latest                            |  72.05        | 75.98
containerdpulltest.azurecr.io/pytorch/pytorch:latest    | 61.45         | 77.1
containerdpulltest.azurecr.io/nvidia/cuda:latest        | 77.13         | 85.47

Signed-off-by: Amr Mahdi <amramahdi@gmail.com>
2020-10-26 05:05:09 +00:00
Avi Deitcher
de082e5627 ensure we cancel child context when reading grpc
Signed-off-by: Avi Deitcher <avi@deitcher.net>
2020-10-14 09:50:48 +03:00
Leonardo Taccari
4c47fe0a2f Add support for NetBSD
Signed-off-by: Leonardo Taccari <leot@NetBSD.org>
2020-09-22 20:03:50 +02:00
Stephen Day
4615111ba2
content/local: validate digest before calculating path
Signed-off-by: Stephen Day <stephen.day@getcruise.com>
2020-04-09 17:37:47 -07:00
Sebastiaan van Stijn
f2edc6f164
vendor: update gotest.tools v3.0.2
full diff: https://github.com/gotestyourself/gotest.tools/compare/v2.3.0...v3.0.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-02-28 17:47:20 +01:00
Derek McGowan
dde436e65b Crypto library movement and changes to content helper interfaces
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-17 15:21:29 -04:00
Stefan Berger
bf8804c743 Implemented image encryption/decryption libraries and ctr commands
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Brandon Lum <lumjjb@gmail.com>
2019-07-17 15:19:58 -04:00
Derek McGowan
63ceaf877d
Add testing log context
Enables showing debug logs in testing output.
For integration tests the client log output will show
in addition to daemon output, with timestamps for better
correlation.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-16 10:31:43 -07:00
Michael Crosby
40f54dc076
Merge pull request #3324 from crosbymichael/content-close
Ensure close in content test
2019-06-05 16:37:05 -04:00
Michael Crosby
cf7fb14efa Update timestamp atomic write
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-05 19:34:55 +00:00
Michael Crosby
4f6ba8286d Ensure close in content test
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-06-04 19:26:34 +00:00
Edgar Lee
faf925ba25 Handle EOF from ReadAt in content.ReadBlob
Signed-off-by: Edgar Lee <edgarl@netflix.com>
2019-06-04 10:18:36 -07:00