Commit Graph

90 Commits

Author SHA1 Message Date
zouyee
11d8beff80 optimize error logs by providing absolute file paths
Signed-off-by: zouyee <zouyee1989@gmail.com>
2024-04-30 09:08:01 +08:00
Maksym Pavlenko
7feb1f327d
Merge pull request #9853 from abel-von/make-shim-independent
sandbox: make an independent shim plugin
2024-04-29 21:07:21 +00:00
Abel Feng
a12acedfad sandbox: make a independent shim plugin
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-04-24 14:27:20 +08:00
Maksym Pavlenko
444679c883
Merge pull request #10109 from dmcgowan/fix-fallback-explicit-tls
Update HTTP fallback to better account for TLS timeout and previous attempts
2024-04-23 04:10:39 +00:00
Derek McGowan
5e470e1cae
Update HTTPFallback to handle tls handshake timeout
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-04-22 18:53:27 -07:00
Danny Canter
b50e9eae43 Refactor spots to make use of sys.IgnoringEintr
This makes use of pkg/sys's IgnoringEintr function
to clean up some of the redundant eintr loops we
had laying around.

Signed-off-by: Danny Canter <danny@dcantah.dev>
2024-04-10 11:24:01 -07:00
Danny Canter
ad584ebecb Replace direct waitid syscall with unix.Waitid
This also replaces the PPidFD constant with the definition in
x/sys/unix

Signed-off-by: Danny Canter <danny@dcantah.dev>
2024-04-10 05:52:43 -07:00
Tobias Klauser
0ec14fdf8c
core/diff/apply: use unix.Syncfs
Use the Syncfs wrapper function defined in the golang.org/x/sys/unix
package instead of manually wrapping it in doSyncFs.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
2024-04-09 15:12:43 +02:00
Maksym Pavlenko
454bd58a27
Merge pull request #10031 from ktock/fail-plain-http-2.0
remote: Fix HTTPFallback fails when pushing manifest
2024-04-07 03:35:19 +00:00
Kohei Tokunaga
4332794384
Transfer: Registry: Enable plain HTTP
Currenlty transfer service doesn't handle plain HTTP connection.
This commit fixes this issue by propagating
`(core/remotes/docker/config).HostOptions.DefaultScheme` from client to the
transfer service.
This commit also fixes ctr to use this feature for "--plain-http" flag.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2024-04-03 10:46:10 +09:00
Derek McGowan
3a8c27dff8
Merge pull request #9908 from ktock/transfer-host-dir
Transfer: Registry: Enable to use registry configuration diretory
2024-04-02 18:59:43 +00:00
Kohei Tokunaga
63d5573a38
remote: Fix HTTPFallback fails when pushing manifest
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2024-04-03 00:28:31 +09:00
Sebastiaan van Stijn
d0d35f0d03
core/images/archive: normalizeReference: remove outdated TODO
This TODO was added in 9e6db71954, at which time
the reference package was part of the docker/distribution (registry) repository.
The reference package has moved to a standalone module, which has been in use
since 4923470902, so this should no longer be a
concern.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-03-20 11:41:50 +01:00
Maksym Pavlenko
124456ef83
Merge pull request #9864 from hinshun/feature/import-compressed
Automatically decompress archives for transfer service import
2024-03-19 22:16:25 +00:00
Edgar Lee
34c545824f Automatically decompress archives for transfer service import
Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
2024-03-15 10:14:19 +08:00
Akihiro Suda
5a23e8878c
Merge pull request #9917 from AkihiroSuda/mv-testutil
mv internal/testutil pkg/testutil
2024-03-12 12:01:16 +00:00
Maksym Pavlenko
6a96e45012
Move shim package to pkg
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-03-07 10:05:26 -08:00
Maksym Pavlenko
7d2bc0620b
Merge pull request #9911 from dmcgowan/introspection-split
Cleanup introspection interface
2024-03-05 03:20:45 +00:00
Akihiro Suda
d9b9160ae1
mv internal/testutil pkg/testutil
The package is consumed by several snapshotter plugins

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-04 17:00:39 +09:00
Kohei Tokunaga
7a3b7fba59
Transfer: Registry: Enable to use registry configuration diretory
Currently transfer service isn't aware of configurations of hosts directory and
ctr's `--hosts-dir` doesn't work.
This commit fixes this issue by using `config.ConfigureHosts` instead of
`docker.ConfigureDefaultRegistries`.
This commit also fixes ctr to use this feature for "--hosts-dir" flag.

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2024-03-04 15:43:30 +09:00
Derek McGowan
1bf781d8eb
Cleanup introspection interface
Split service proxy from service plugin.
Make introspection service easier for clients to use.
Update service proxy to support grpc and ttrpc.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-03-01 23:07:42 -08:00
Derek McGowan
347346e3cf
Add ttrpc support to content proxy
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-03-01 14:27:27 -08:00
Derek McGowan
9104e6a24f
Add events proxy interface
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-03-01 14:27:27 -08:00
Phil Estes
9a2b85561a
Merge pull request #9867 from daghack/oci-add-mediatype
adds mediatype to oci index record
2024-02-29 21:32:59 +00:00
Talon
17ea3959bc adds mediatype to oci index record
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
2024-02-29 10:04:48 -08:00
Fu Wei
6333db7701
Merge pull request #9891 from dmcgowan/move-events-plugin
Move events to plugins and core
2024-02-29 12:45:25 +00:00
Derek McGowan
72f21833b1
Move events to plugins and core
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-27 22:09:20 -08:00
Phil Estes
f0c64a9fa0
Merge pull request #9859 from DataDog/jb/zstd-support
mediatypes: support zstd compression
2024-02-27 22:31:41 +00:00
amghazanfari
bd44df8a1c refactor code - clean switch and if statements
Signed-off-by: amghazanfari <a.m.ghazanfari76@gmail.com>
2024-02-26 22:07:14 +03:30
Julien Balestra
d651cb743d mediatypes: support zstd compression
Signed-off-by: Julien Balestra <julien.balestra@gmail.com>
2024-02-22 18:35:08 +01:00
Abel Feng
522130a667 sandbox: support vsock connection to task api
Signed-off-by: Abel Feng <fshb1988@gmail.com>
2024-02-22 01:36:38 +00:00
Derek McGowan
b8654e36f4
Merge pull request #8379 from jedevc/docker-pusher-concurrency
Fix various timing issues with docker pusher
2024-02-21 17:59:56 +00:00
Maksym Pavlenko
4510ca3db1
Merge pull request #9789 from dmcgowan/update-restart-plugin-type
Add container monitor plugin type for restart
2024-02-20 21:56:37 +00:00
Derek McGowan
f8f1e5f7a6
Add container monitor plugin type for restart
Adds a plugin type for container monitor.
Rename the task monitor type to avoid confusion.
Add config migration for new plugin types to pass existing migration
tests.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-15 21:54:40 -08:00
Akihiro Suda
99721c27e1
Disable the support for Schema 1 images
Schema 1 (`application/vnd.docker.distribution.manifest.v1+prettyjws`) has been
officially deprecated since containerd v1.7 (PR 6884).

We have planned to remove the support for Schema 1 in containerd v2.0, but this
removal may still surprise some users.
So, in containerd v2.0 we will just disable it by default.

The support for Schema 1 can be still enabled by setting an environment variable
`CONTAINERD_ENABLE_DEPRECATED_PULL_SCHEMA_1_IMAGE=1`, however, this workaround
will be completely removed in containerd v2.1.

Schema 2 was introduced in Docker 1.10 (Feb 2016), so most users should
have been already using Schema 2 or OCI.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-02-15 11:11:35 +09:00
Alexandru Matei
ccec1e6e4c Remove internal LoopConfig struct
The struct is now part of golang.org/x/sys.
Follow-up for #9805

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
2024-02-13 11:49:28 +02:00
Alexandru Matei
c2dfae8d05 go.mod: Bump golang.org/x/sys to v0.17.0
Replace internal LOOP_CONFIGURE ioctl implementation with
IoctlLoopConfigure from sys

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
2024-02-12 15:55:33 +02:00
Maksym Pavlenko
5ca56ddbb4 Remove deprecated funcs from restart package
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-10 17:54:48 -08:00
Derek McGowan
f46aea6187
Move transfer and unpack packages
Packages related to transfer and unpacking provide core interfaces which
use other core interfaces and part of common functionality.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-07 22:40:15 -08:00
Derek McGowan
9eb9038a9e
Avoid publishing data events during transaction
Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-06 21:38:32 -08:00
Derek McGowan
86530c0afb
Move image event publishing to metadata store
The metadata store is in the best place to handle events directly after
the database has been updated. This prevents every user of the image
store interface from having to know whether or not they are responsible
for publishing events and avoid double events if the grpc local service
is used.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2024-02-06 21:24:55 -08:00
Justin Chadwell
a9152ebf89 copy: prevent potential deadlock if close before fully written
We also need an additional check to avoid setting both the error and
response which can create a race where they can arrive in the receiving
thread in either order.

If we hit an error, we don't need to send the response.

> There is a condition where the registry (unexpectedly, not to spec)
> returns 201 or 204 on the put before the body is fully written. I would
> expect that the http library would issue close and could fall into a
> deadlock here. We could just read respC and call setResponse. In that
> case ErrClosedPipe would get returned and Commit shouldn't be called
> anyway.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:20:11 +01:00
Justin Chadwell
b48e1141eb copy: setError should imply Close
If sending two messages from goroutine X:

	a <- 1
	b <- 2

And receiving them in goroutine Y:

	select {
	case <- a:
	case <- b:
	}

Either branch of the select can trigger first - so when we call
.setError and .Close next to each other, we don't know whether the done
channel will close first or the error channel will receive first - so
sometimes, we get an incorrect error message.

We resolve this by not sending both signals - instead, we can have
.setError *imply* .Close, by having the pushWriter call .Close on
itself, after receiving an error.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:20:11 +01:00
Justin Chadwell
e4f91c2df0 copy: remove max number of ErrResets
If a writer continually asks to be reset then it should always succeed -
it should be the responsibility of the underlying content.Writer to
stop producing ErrReset after some amount of time and to instead return
the underlying issue - which pushWriter already does today, using the
doWithRetries function.

doWithRetries already has a separate cap for retries of 6 requests (5
retries after the original failure), and it seems like this would be
previously overridden by content.Copy's max number of 5 attempts, hiding
the original error.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:20:10 +01:00
Justin Chadwell
651cfa2a2c pushWriter: refactor reset pipe logic into separate function
Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:18:05 +01:00
Justin Chadwell
9d7641ff3e copy: improve error detection from closed pipes
If we get io.ErrClosedPipe in pushWriter.Write, there are three possible
scenarios:

- The request has failed, we need to attempt a reset, so we can expect a
  new pipe incoming on pipeC.
- The request has failed, we don't need to attempt a reset, so we can
  expect an incoming error on errC.
- Something else externally has called Close, so we can expect the done
  channel to be closed.

This patch ensures that we block for as long as possible (while still
handling each of the above cases, so we avoid hanging), to make sure
that we properly return an appropriate error message each time.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:18:05 +01:00
Justin Chadwell
91a50f70b7 copy: check if writer was closed before setting a pipe
If Close is called externally before a request is attempted, then we
will accidentally attempt to send to a closed channel, causing a panic.

To avoid this, we can check to see if Close has been called, using a
done channel. If this channel is ever done, we drop any incoming errors,
requests or pipes - we don't need them, since we're done.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:18:05 +01:00
Justin Chadwell
4660f63033 copy: remove wrapping io.NopCloser from push writer pipe
io.Pipe produces a PipeReader and a PipeWriter - a close on the write
side, causes an error on both the read and write sides, while a close on
the read side causes an error on only the read side. Previously, we
explicitly prohibited closing from the read side.

However, http.Request.Body requires that "calling Close should unblock a
Read waiting for input". Our reader will not do this - calling close
becomes a no-op. This can cause a deadlock because client.Do may never
terminate in some circumstances.

We need the Reader side to close its side of the pipe as well, which it
already does using the go standard library - otherwise, we can hang
forever, writing to a pipe that will never be closed.

Allowing the requester to close the body should be safe - we never reuse
the same reader between requests, as the result of body() will never be
reused by the guarantees of the standard library.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2024-02-03 10:18:05 +01:00
Maksym Pavlenko
7f2d2c4f44 Move Message proto to types
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-02 10:35:23 -08:00
Phil Estes
f5f84a9c75
Merge pull request #8735 from iain-macdonald/iain-macdonald/issue-6377
remotes/docker/authorizer.go: refresh OAuth tokens when they expire
2024-01-29 16:18:56 +00:00