Commit Graph

3094 Commits

Author SHA1 Message Date
yanxuean
d56b49dd7c provide client.WithLease to user
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-11-23 10:24:41 +08:00
Stephen J Day
e8f52c35ce
linux/shim: reduce memory overhead by using ttrpc
By replacing grpc with ttrpc, we can reduce total memory runtime
requirements and binary size. With minimal code changes, the shim can
now be controlled by the much lightweight protocol, reducing the total
memory required per container.

When reviewing this change, take particular notice of the generated shim
code.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-22 12:21:48 -08:00
Stephen Day
8e09b565a7
Merge pull request #1795 from crosbymichael/cgroup-lock
Add lock around task cgroup
2017-11-22 12:09:02 -08:00
Michael Crosby
e830112efd Add lock around task cgroup
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-22 11:14:08 -05:00
Michael Crosby
1a6e6a96a4
Merge pull request #1794 from yanxuean/some-typo
some typo
2017-11-22 10:51:48 -05:00
yanxuean
81307793b7 some typo
Signed-off-by: yanxuean <yan.xuean@zte.com.cn>
2017-11-22 11:48:09 +08:00
Derek McGowan
92d40b9a2d
Add test for container as gc root
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-21 16:26:36 -08:00
Derek McGowan
bae47820d7
Document defaults
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-21 16:12:10 -08:00
Derek McGowan
b674c64827
Support unknown size from schema 1 manifests
Schema1 manifests did not set a size in the digest for the blobs,
breaking the expectations of the update http seeking reader. Now
the http seeker has been updated to support unknown size as a
value of negative 1 and the schema1 puller sets the unknown size
accordingly.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-21 15:45:09 -08:00
Stephen Day
2b1c915f82
Merge pull request #1787 from AkihiroSuda/diff-link
fs/diff: support symlink to abspath with second-precision mtime
2017-11-21 10:33:25 -08:00
Michael Crosby
633f4a6b3e
Merge pull request #1751 from dnephin/add-unused-linters
Remove deadcode
2017-11-21 11:56:53 -05: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
Michael Crosby
96e2f30250
Merge pull request #1759 from dnephin/single-integration-target
Remove duplicate integration target
2017-11-21 10:57:22 -05:00
Akihiro Suda
a3aeb398fe fs/diff: support symlink to abspath with second-precision mtime
Previously, `Changes()` for a symlink to absolute path, with second-precision
mtime of the link itself always resulted in ENOENT.

This is because `compareFileContent()` was called for the link target path, without changing the root path.

Fix moby/buildkit#172

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-21 04:38:34 +00:00
Derek McGowan
374f04d0e9
Update gc policy configuration to use time duration
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 17:08:35 -08:00
Derek McGowan
3f1a61f76a
Add synchronous image delete
Synchronous image delete provides an option image delete to wait
until the next garbage collection deletes after an image is removed
before returning success to the caller.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 17:08:35 -08:00
Derek McGowan
72fb8f8f40
Add gc labels to content tests
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 16:57:40 -08:00
Derek McGowan
56b6a5dbd1
Add root labels to snapshot test suite
Prevents cleanup by garbage collectors running on snapshotters.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 16:57:40 -08:00
Derek McGowan
00596f400e
Add gc policy plugin
Add garbage collection as a background process and policy
configuration for configuring when to run garbage collection.
By default garbage collection will run when deletion occurs
and no more than 20ms out of every second.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-20 16:57:39 -08:00
Michael Crosby
1bd39d36ed
Merge pull request #1788 from crosbymichael/plugin
Add plugin stability guarantees to release.md
2017-11-20 11:19:27 -05:00
Michael Crosby
23dfe54894 Add plugin stability guarantees to release.md
Closes #1336

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-20 10:54:10 -05:00
Kenfe-Mickaël Laventure
9649a428e8
Merge pull request #1784 from stevvooe/remove-sync-write
content/local: don't open file with sync
2017-11-17 17:55:20 -08:00
Stephen Day
95cbe81247
Merge pull request #1783 from crosbymichael/static-shim
Compile shim without cgo for size and mem usage
2017-11-17 16:30:24 -08:00
Stephen J Day
5113299cb6
content/local: don't open file with sync
After running into performance issues when sending in certain kinds of
content, synchronous writes for content have been removed. Content is
still synced on commit, so this shouldn't be necessary.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-17 16:25:03 -08:00
Michael Crosby
67232e93dc
Merge pull request #1779 from AkihiroSuda/resolve-util-bin
shim: support non-default binary name
2017-11-17 17:53:43 -05:00
Michael Crosby
434f0e679f Compile shim without cgo for size and mem usage
This compiles the shim without cgo and statically which ends up to have
lower memory usage and binary size.  buildmode=pie cannot be used
without cgo.

ref: https://github.com/golang/go/issues/17789#issuecomment-258542220

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-17 17:32:49 -05:00
Akihiro Suda
7ef4aa5c25 shim: support non-default binary name
The binary name used for executing "containerd publish" was hard-coded
in the shim code, and hence it did not work with customized daemon
binary name. (e.g. `docker-containerd`)

This commit allows specifying custom daemon binary via `containerd-shim
-containerd-binary ...`.
The daemon invokes this command with `os.Executable()` path.

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-11-17 22:21:54 +00:00
Akihiro Suda
2fad7822e3
Merge pull request #1782 from dnephin/move-io-pkg
Move io.go into io package
2017-11-18 07:20:15 +09: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
Kenfe-Mickaël Laventure
bc063f263c
Merge pull request #1778 from stevvooe/weak-imports-on-plugins
api: use weak imports for plugin protobufs
2017-11-17 08:48:16 -08:00
Phil Estes
2edc475818
Merge pull request #1776 from stevvooe/decouple-events-grpc
events: decouple events package from grpc
2017-11-17 11:44:46 -05:00
Michael Crosby
a4968710fd
Merge pull request #1777 from jessvalarezo/migrate-client-code
client: migrate client code to containerd
2017-11-17 09:32:34 -05:00
Phil Estes
77cb722e1c
Merge pull request #1775 from dmcgowan/fix-push-different-tags
Update docker pusher check tag
2017-11-17 08:21:08 -05:00
Stephen J Day
50532f231a
api: use weak imports for plugin protobufs
Because of a side-effect import, we have the possibility of pulling in
several unnecessary packages that are used by the plugin and not at
runtime to implement protobuf structures. Setting these imports to
`weak` prevents this from happening, reducing the total import set,
reducing memory usage and binary size.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 20:18:15 -08:00
Stephen Day
9cb91f8bfa
Merge pull request #1765 from dmcgowan/rm-lease-resources
Add support for removing leases on resource removal
2017-11-16 18:53:53 -08:00
Stephen J Day
2d05c4aa1a
events: decouple events package from grpc
By defining a concrete, non-protobuf type for the events interface, we
can completely decouple it from the grpc packages that are expensive at
runtime. This does requires some allocation cost for converting between
types, but the saving for the size of the shim are worth it.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 18:49:46 -08:00
Jess Valarezo
8c5dede74e client: move content store client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-16 18:14:21 -08:00
Jess Valarezo
aefaeeacb0 client: move diff client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-16 18:06:14 -08:00
Jess Valarezo
8d23e5ef9c client: move image store client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-16 17:47:54 -08:00
Jess Valarezo
6cd9962c7f client: move namespaces client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-16 17:47:38 -08:00
Derek McGowan
56a35d5cb9
Update docker pusher check tag
Currently pushing a new tag to a manifest which already
exists in the registry skips the tag push because it
only checks that the manifest exists. This updates the
logic to instead check if the tag exists and is at the
same digest.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-11-16 17:29:29 -08:00
Derek McGowan
5c6e789dde
Merge pull request #1769 from stevvooe/split-events-types
api/events: split event types from events service
2017-11-16 16:29:28 -08:00
Jess Valarezo
5b64f7030d client: move snapshot client to containerd package
Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
2017-11-16 15:45:07 -08:00
Stephen J Day
09b5ca1072
api/events: split event types from events service
To avoid importing all of grpc when consuming events, the types of
events have been split in to a separate package. This should allow a
reduction in memory usage in cases where a package is consuming events
but not using the gprc service directly.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 15:20:46 -08:00
Stephen Day
fc149f0ef9
Merge pull request #1770 from crosbymichael/resume
content, remotes: download resumption support
2017-11-16 13:57:19 -08:00
Michael Crosby
4192f99cf0 Only compare times on non-windows
There is a bug in the windows CI that causes a time difference between
the host and the container.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2017-11-16 16:25:18 -05:00
Stephen J Day
3e5e2ecc0a content/local: consistent handling of data and locks
The locks now retry on the backend side to prevent clients from having
to round trip on locks that might be momentarily held. This exposed some
timing errors in the updated_at fields for content ingest, so we've had
to move that to a separate file to export the monotonic go runtime
timestamps.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 16:13:19 -05:00
Stephen J Day
f4fdb940ed vendor: include require package from testify
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 16:13:13 -05:00
Stephen J Day
682151b166 remotes/docker: implement seekable http requests
To support resumable download, the fetcher for a remote must implement
`io.Seeker`. If implemented the `content.Copy` function will detect the
seeker and begin from where the download was terminated by a previous
attempt.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 16:13:06 -05:00
Stephen J Day
a9308e174d content/local: ensure that resumption is properly supported
While early PoCs had download resumption working, we didn't have tests
and had not verified the behavior. With this test suite, we now are able
to show that download resumption is properly supported in the content
store. In particular, there was a bug where resuming a download would
not issue the writes to the correct offset in the file. A Seek was added
to ensure we are writing from the current ingest offset.

In this investigation, it was also discovered that using the OS/Disk
created time on files was skewed from the monotonic clock in Go's
runtime. The startedat values are now taken from the Go runtime and
written to a separate file.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 16:12:59 -05:00