Commit Graph

156 Commits

Author SHA1 Message Date
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
Tonis Tiigi
5b9bd993a8 differ: fix deadlock on commit error
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-04-25 17:50:17 -07:00
fesu
7045801fd4 delete the ingest when any errors happen during resuming status
Signed-off-by: Su Fei  <fesu@ebay.com>
2019-04-06 11:21:18 +08:00
Phil Estes
41e3aaee58
Merge pull request #3008 from JoeWrightss/patch-3
Fix some misspells in helpers_test.go
2019-02-13 09:58:37 -08:00
zhoulin xie
bfb266ab5d Fix some misspells in helpers_test.go
Signed-off-by: zhoulin xie <zhoulin.xie@daocloud.io>
2019-02-14 00:02:17 +08:00
Wei Fu
132ee9b826 fix: linter issue
megacheck, gosimple and unused has been deprecated and subsumed by
staticcheck. And staticcheck also has been upgraded. we need to update
code for the linter issue.

close: #2945

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-01-23 22:54:51 +08:00
Derek McGowan
8706a355dd
Merge pull request #2889 from linxiulei/isolated_content
metadata: define content sharing policy
2019-01-14 13:15:38 -08:00
JoeWrightss
17b77aeb0e Fix annotation typo errors
Signed-off-by: JoeWrightss <zhoulin.xie@daocloud.io>
2018-12-31 22:40:06 +08:00
Eric Lin
4247f2684d metadata: define content sharing policy
This changeset modifies the metadata store to allow one to set a
"content sharing policy" that defines how blobs are shared between
namespaces in the content store.

The default mode "shared" will make blobs available in all namespaces
once it is pulled into any namespace.  The blob will be pulled into
the namespace if a writer is opened with the "Expected" digest that
is already present in the backend.

The alternative mode, "isolated" requires that clients prove they have
access to the content by providing all of the content to the ingest
before the blob is added to the namespace.

Both modes share backing data, while "shared" will reduce total
bandwidth across namespaces, at the cost of allowing access to any
blob just by knowing its digest.

Note: Most functional codes and changelog of this commit originate from
Stephen J Day <stephen.day@docker.com>, see
40455aade8

Fixes #1713 Fixes #2865

Signed-off-by: Eric Lin <linxiulei@gmail.com>
2018-12-21 15:02:21 +08:00
Derek McGowan
0f756495a9
Fix writer deadlock in local store
The local store could end up in a state where the writer is
closed but the reference is locked after a commit on an
existing object.
Cleans up Commit logic to always close the writer even after
an error occurs, guaranteeing the reference is unlocked after commit.
Adds a test to the content test suite to verify this behavior.
Updates the content store interface definitions to clarify the behavior.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-10-15 16:33:45 -07:00
Derek McGowan
da6d29033c
Clean up error messages
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-17 14:41:43 -07:00
Derek McGowan
a62be324b7
Unify docker and oci importer
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-17 14:41:43 -07: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
c0cb2f2568
Add testcase for commit already exist
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-13 17:38:28 -07:00
Michael Wan
92243ff72a bugfix: updatedAt timestamp file may be empty
Signed-off-by: Michael Wan <zirenwan@gmail.com>
2018-08-29 21:49:40 -04:00
Derek McGowan
dfc9991135
Add content ingests to lease and gc
Allow content ingests to be cleaned up during gc.
Use a default expiration on content ingests or make
use of the lease expiration when provided.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-25 16:54:14 -07:00
Michael Crosby
e17969caad
Merge pull request #2436 from thaJeztah/fix_gofmt
Workaround for gofmt change in Go 1.11
2018-07-17 14:52:29 -04:00
Derek McGowan
1c6929cbd4
Remove use of crypto rand in tests
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-07-12 17:51:55 -07:00
Sebastiaan van Stijn
383d750d4f
Workaround for gofmt change in Go 1.11
Go 1.11 uses a different formatting for maps, and now
aligns values; running `gofmt -s -w` on this file resulted
in this diff;

```patch
 content/testsuite/testsuite.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/content/testsuite/testsuite.go b/content/testsuite/testsuite.go
index 974c7cb8ed..d9ae9dc160 100644
--- a/content/testsuite/testsuite.go
+++ b/content/testsuite/testsuite.go
@@ -365,8 +365,8 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {

 	rootTime := time.Now().UTC().Format(time.RFC3339)
 	labels := map[string]string{
-		"k1": "v1",
-		"k2": "v2",
+		"k1":                    "v1",
+		"k2":                    "v2",
 		"containerd.io/gc.root": rootTime,
 	}

@@ -402,7 +402,7 @@ func checkLabels(ctx context.Context, t *testing.T, cs content.Store) {
 	}

 	info.Labels = map[string]string{
-		"k1": "v1",
+		"k1":                    "v1",
 		"containerd.io/gc.root": rootTime,
 	}
 	preUpdate = time.Now()
```

Adding a whitespace before the long key to make it format the same
on both Go 1.11 and older versions of Go.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-07-05 11:05:30 +02:00
Vincent Demeester
832b05ae67
Update tests to use gotest.tools angel
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-06-08 21:02:01 +02: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
Phil Estes
e9434a10bc
Merge pull request #2341 from dmcgowan/move-client-content-snapshot
Move client implementations for content store and snapshotter
2018-05-25 13:47:39 -04:00
Michael Crosby
009ba4d797 Move testutils to pkg
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-22 17:08:38 -04:00
Derek McGowan
7c80d0ae11
Rename remote content to proxy content
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-09 15:04:52 -07:00
Derek McGowan
6e64091322
Move client content store to proxy package
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-08 14:54:02 -07:00
Derek McGowan
3a6825e1a0
content: remove unnecessary defer in helpers
Deferring the put back of the buffer is not necessary since
it can be done immediately after use, before checking error.
This decreases the amount of the time the buffer is out
of the pool and not in use.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-04-20 11:55:59 -07:00
Derek McGowan
ad6d02b881
Merge pull request #2221 from AkihiroSuda/content-small-blob
services/content: fix reading a blob which is smaller than the read buffer
2018-03-26 10:43:23 -07:00
Stephen J Day
a76f230984
content/testsuite: include small blob test in standard suite
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-03-26 08:39:39 -07:00
Akihiro Suda
7b323b1402 services/content: fix reading a blob which is smaller than the read buffer.
The newly added test fails without this fix in services/content/service.go:

    $ go test -c . && sudo ./containerd.test -test.v -test.root -test.run TestContentClient
    ...
        --- FAIL: TestContentClient/SmallBlob (0.02s)
            provideringester.go:62: rpc error: code = OutOfRange desc = read
    past object length 6 bytes
            helpers.go:67: drwx------       4096
    /tmp/content-suite-ContentClient-286788688
    FAIL

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-03-23 12:51:28 +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