Commit graph

45450 commits

Author SHA1 Message Date
Akihiro Suda
219ced474d
Merge pull request #44819 from thaJeztah/bump_netns
vendor: github.com/vishvananda/netns v0.0.1
2023-01-14 08:45:44 +09:00
Cory Snider
2504e4ad0d
Merge pull request #44805 from corhere/libnet/return-concrete-types
libnetwork: replace some unnecessary interfaces with their concrete types
2023-01-13 17:00:37 -05:00
Cory Snider
8be470eea8 libnetwork: don't embed mutex in network
Embedded structs are part of the exported surface of a struct type.
Boxing a struct value into an interface value does not erase that;
any code could gain access to the embedded struct value with a simple
type assertion. The mutex is supposed to be a private implementation
detail, but *network implements sync.Locker because the mutex is
embedded. Change the mutex to an unexported field so *network no
longer spuriously implements the sync.Locker interface.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:19:06 -05:00
Cory Snider
c71555f030 libnetwork: return concrete-typed *Endpoint
libnetwork.Endpoint is an interface with a single implementation.

https://github.com/golang/go/wiki/CodeReviewComments#interfaces

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:19:06 -05:00
Cory Snider
581f005aad libnetwork: don't embed mutex in endpoint
Embedded structs are part of the exported surface of a struct type.
Boxing a struct value into an interface value does not erase that;
any code could gain access to the embedded struct value with a simple
type assertion. The mutex is supposed to be a private implementation
detail, but *endpoint implements sync.Locker because the mutex is
embedded. Change the mutex to an unexported field so *endpoint no
longer spuriously implements the sync.Locker interface.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:19:06 -05:00
Cory Snider
0e91d2e0e9 libnetwork: return concrete-typed *Sandbox
Basically every exported method which takes a libnetwork.Sandbox
argument asserts that the value's concrete type is *sandbox. Passing any
other implementation of the interface is a runtime error! This interface
is a footgun, and clearly not necessary. Export and use the concrete
type instead.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:19:06 -05:00
Cory Snider
0425baf883 libnetwork: don't embed mutex in sandbox
Embedded structs are part of the exported surface of a struct type.
Boxing a struct value into an interface value does not erase that;
any code could gain access to the embedded struct value with a simple
type assertion. The mutex is supposed to be a private implementation
detail, but *sandbox implements sync.Locker because the mutex is
embedded. Change the mutex to an unexported field so *sandbox no
longer spuriously implements the sync.Locker interface.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:09:37 -05:00
Cory Snider
f96b9bf761 libnetwork: return concrete-typed *Controller
libnetwork.NetworkController is an interface with a single
implementation.

https://github.com/golang/go/wiki/CodeReviewComments#interfaces

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:09:37 -05:00
Cory Snider
ae09fe3da7 libnetwork: don't embed mutex in controller
Embedded structs are part of the exported surface of a struct type.
Boxing a struct value into an interface value does not erase that;
any code could gain access to the embedded struct value with a simple
type assertion. The mutex is supposed to be a private implementation
detail, but *controller implements sync.Locker because the mutex is
embedded.

    c, _ := libnetwork.New()
    c.(sync.Locker).Lock()

Change the mutex to an unexported field so *controller no longer
spuriously implements the sync.Locker interface.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-13 14:09:37 -05:00
Brian Goff
483b03562a
Merge pull request #44491 from corhere/libnetwork-minus-reexec
libnetwork: eliminate almost all reexecs
2023-01-13 10:44:25 -08:00
Sebastiaan van Stijn
bb5cae2c94
vendor: github.com/vishvananda/netns v0.0.1
The project started tagging releases for go modules.

full diff: https://github.com/vishvananda/netns/compare/2eb08e3e575f...v0.0.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-13 14:55:18 +01:00
Bjorn Neergaard
868c897ad7
Merge pull request #44790 from neersighted/wide_json
daemon/config: support alternate (common) unicode encodings using a BOM
2023-01-12 13:15:58 -07:00
Bjorn Neergaard
4cd84c4b13
Merge pull request #44773 from neersighted/daemon_config_test
daemon/config: clean up tests to use common helper
2023-01-12 13:13:35 -07:00
Bjorn Neergaard
228f82fcda
Merge pull request #44628 from vvoland/c8d-import-upstream
daemon/c8d: Implement import
2023-01-12 09:35:43 -07:00
Bjorn Neergaard
5bb0e7080a
Merge pull request #44791 from corhere/default-sigquit-handler
cmd/dockerd: use default SIGQUIT behaviour
2023-01-12 08:37:05 -07:00
Bjorn Neergaard
dae48a8064
Merge pull request #44803 from akerouanton/fix-44721
libnetwork: Remove iptables nat rule when hairpin is disabled
2023-01-12 08:36:10 -07:00
Bjorn Neergaard
4c02882f8a
Merge pull request #43225 from aivus/docker-in-overlayfs
Work around missing rename support when the backing filesystem is overlayfs
2023-01-11 17:54:32 -07:00
Bjorn Neergaard
6d212fa045
Merge pull request #44756 from rumpl/containerd-image-pull
containerd integration: image pull
2023-01-11 16:22:48 -07:00
Cory Snider
102090916e libnetwork: addRedirectRules without reexec
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:14:32 -05:00
Cory Snider
582dd705c1 libnetwork: fwmarker without reexec
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:14:32 -05:00
Cory Snider
d6cc02d301 libnetwork: drop (resolver).resolverKey field
...as it is now unused.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:14:32 -05:00
Cory Snider
50a4951ddc libnetwork: setup DNS resolver without reexec
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:14:32 -05:00
Cory Snider
4733127a04 libnetwork: set default VLAN without reexec
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:14:31 -05:00
Cory Snider
7037c48e58 libnetwork: set IPv6 without reexec
unshare.Go() is not used as an existing network namespace needs to be
entered, not a new one created. Explicitly lock main() to the initial
thread so as not to depend on the side effects of importing the
internal/unshare package to achieve the same.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:05:39 -05:00
Cory Snider
0246332954 libnetwork: create netns without reexec
Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-11 12:05:39 -05:00
Bjorn Neergaard
ffb2c1fb4a
Merge pull request #44802 from akerouanton/libnetwork-sysfs-cleanup
libnetwork: Clean up sysfs-based operations
2023-01-11 10:04:51 -07:00
Albin Kerouanton
ef161d4aeb
libnetwork: Clean up sysfs-based operations
- The oldest kernel version currently supported is v3.10. Bridge
parameters can be set through netlink since v3.8 (see
torvalds/linux@25c71c7). As such, we don't need to fallback to sysfs to
set hairpin mode.
- `scanInterfaceStats()` is never called, so no need to keep it alive.
- Document why `default_pvid` is set through sysfs

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-01-11 17:01:53 +01:00
Paweł Gronowski
9032e6779d c8d/resolver: Fallback to http for insecure registries
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 17:00:27 +01:00
Nicolas De Loof
c83fce86d4 c8d/resolver: Use hosts from daemon configuration
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2023-01-11 17:00:27 +01:00
Paweł Gronowski
3a3f98b32b c8d/pull: Don't unpack manually
We pass WithPullUnpack anyway

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 17:00:27 +01:00
Nicolas De Loof
4a8c4110e3 produce progress events polling ctrd's content.Store
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

containerd: Push progress

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 17:00:26 +01:00
Albin Kerouanton
566a2e4c79
libnetwork: Remove iptables nat rule when hairpin is disabled
When userland-proxy is turned off and on again, the iptables nat rule
doing hairpinning isn't properly removed. This fix makes sure this nat
rule is removed whenever the bridge is torn down or hairpinning is
disabled (through setting userland-proxy to true).

Unlike for ip masquerading and ICC, the `programChainRule()` call
setting up the "MASQ LOCAL HOST" rule has to be called unconditionally
because the hairpin parameter isn't restored from the driver store, but
always comes from the driver config.

For the "SKIP DNAT" rule, things are a bit different: this rule is
always deleted by `removeIPChains()` when the bridge driver is
initialized.

Fixes #44721.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
2023-01-11 16:32:18 +01:00
Sebastiaan van Stijn
a0572a40ab
Merge pull request #44793 from thaJeztah/bump_go_1.19.5
update to go1.19.5
2023-01-11 16:26:00 +01:00
Sebastiaan van Stijn
d3dec8fae1
Merge pull request #44784 from thaJeztah/api_sync_docs
docs: api: synchronise versioned API docs (v1.39 - v1.42)
2023-01-11 13:55:42 +01:00
Paweł Gronowski
d7deec1993
daemon/c8d: Implement import
If the imported layer archive is uncompressed, it gets compressed with
gzip before writing to the content store.
Archives compressed with gzip and zstd are imported as-is.
Xz and bzip2 are recompressed into gzip.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 13:53:44 +01:00
Paweł Gronowski
a254dad2e5
api/import: Guard from Digested instead of Canonical reference
Import shouldn't accept any digested reference, instead of only strictly
canonical ones.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 13:53:42 +01:00
Paweł Gronowski
28327f10a2
daemon/import: Extract common logic to api
Extract logic that would need to be duplicated in both implementations
of ImageService.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2023-01-11 13:53:40 +01:00
Bjorn Neergaard
b139a7636f
Merge pull request #44792 from neersighted/rip_derek
CONTRIBUTING.md: drop reference to the Derek GitHub bot
2023-01-10 17:30:44 -07:00
Bjorn Neergaard
8dbc5df952
daemon/config: inform the user when the input JSON contains invalid UTF-8
This helps ensure that users are not surprised by unexpected tokens in
the JSON parser, or fallout later in the daemon.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
2023-01-10 17:27:21 -07:00
Sebastiaan van Stijn
155e8d7d78
update to go1.19.5
go1.19.5 (released 2023-01-10) includes fixes to the compiler, the linker,
and the crypto/x509, net/http, sync/atomic, and syscall packages. See the
Go 1.19.5 milestone on the issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.19.5+label%3ACherryPickApproved

full diff: https://github.com/golang/go/compare/go1.19.4...go1.19.5

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-11 00:15:35 +01:00
Bjorn Neergaard
d42495033e
daemon/config: support alternate (common) unicode encodings using a BOM
This is a pragmatic but impure choice, in order to better support the
default tools available on Windows Server, and reduce user confusion due
to otherwise inscrutable-to-the-uninitiated errors like the following:

> invalid character 'þ' looking for beginning of value
> invalid character 'ÿ' looking for beginning of value

While meaningful to those who are familiar with and are equipped to
diagnose encoding issues, these characters will be hidden when the file
is edited with a BOM-aware text editor, and further confuse the user.

Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
2023-01-10 15:49:15 -07:00
Bjorn Neergaard
8d1e56e210
CONTRIBUTING.md: drop reference to the Derek GitHub bot
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
2023-01-10 15:42:09 -07:00
Cory Snider
0867d3173c cmd/dockerd: use default SIGQUIT behaviour
dockerd handles SIGQUIT by dumping all goroutine stacks to standard
error and exiting. In contrast, the Go runtime's default SIGQUIT
behaviour... dumps all goroutine stacks to standard error and exits.
The default SIGQUIT behaviour is implemented directly in the runtime's
signal handler, and so is both more robust to bugs in the Go runtime and
does not perturb the state of the process to anywhere near same degree
as dumping goroutine stacks from a user goroutine. The only notable
difference from a user's perspective is that the process exits with
status 2 instead of 128+SIGQUIT.

Signed-off-by: Cory Snider <csnider@mirantis.com>
2023-01-10 17:11:54 -05:00
Bjorn Neergaard
1dcf7d5b03
daemon/config: clean up tests to use common helper
Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
2023-01-10 13:54:17 -07:00
Jan Garcia
1e1d326b50 plugins: Move GlobalSpecPaths into LocalRegistry
Signed-off-by: Jan Garcia <github-public@n-garcia.com>
2023-01-10 21:33:49 +01:00
Cory Snider
62296f9281
Merge pull request #44087 from jchorl/josh/sdkupgrade
Upgrade to aws go sdk v2 for cloudwatch logging driver
2023-01-10 14:51:30 -05:00
Akihiro Suda
cf3ce189ab
Merge pull request #44782 from thaJeztah/no_dockerio
use example.com for tests and examples
2023-01-11 03:31:11 +09:00
Sebastiaan van Stijn
805aea501a
docs: api: synchronise versioned API docs (v1.39 - v1.41)
synchronises some fixes between these API versions for the documentation,
including fixes from:

- 52a9f1689a
- 345346d7c6
- 18f85467e7
- 1557892c37

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-10 16:42:44 +01:00
Sebastiaan van Stijn
92cbd1c69e
docs: api: synchronise versioned API docs (v1.42)
synchronises some fixes between these API versions for the documentation,
including fixes from:

- 18f85467e7
- 345346d7c6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-01-10 16:42:23 +01:00
Sebastiaan van Stijn
fb80e8a1c4
Merge pull request #44061 from fussybeaver/44059-swagger-create-image-info
api: swagger: add errorDetail to CreateImageInfo
2023-01-10 16:06:43 +01:00