Commit Graph

54550 Commits

Author SHA1 Message Date
Paweł Gronowski
2d69edd28a client/image_(inspect,history,load,save): Wrap return values
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 14:23:38 +02:00
Rob Murray
7066eb3736 Merge pull request #51223 from thaJeztah/cleaner_marshal
libnetwork: EndpointInterface: cleanup marshal/unmarshal
2025-10-21 12:10:36 +01:00
Sebastiaan van Stijn
acc9563f48 Merge pull request #51228 from thaJeztah/move_some_integration_cli_tests
integration-cli: move some tests to integration
2025-10-21 12:48:12 +02:00
Sebastiaan van Stijn
79f01e4ffc Merge pull request #51217 from thaJeztah/hotel_california
libnetwork/drivers/macvlan, ipvlan: remove some redundant code, and cleanups / fixes
2025-10-21 12:03:01 +02:00
Sebastiaan van Stijn
9fe856a5f3 integration-cli: move some tests to integration
Migrates:

- TestAPIErrorJSON
- TestContainerAPIInvalidPortSyntax
- TestContainerAPIRestartPolicyInvalidPolicyName
- TestContainerAPIRestartPolicyRetryMismatch
- TestContainerAPIRestartPolicyNegativeRetryCount
- TestContainerAPIRestartPolicyDefaultRetryCount
- TestCreateWithTooLowMemoryLimit

Co-authored-by: Sameer Gupta <sameergupta4873@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 12:01:55 +02:00
Sebastiaan van Stijn
1ff6a963ad Merge pull request #51216 from sameergupta4873/50159-migrate-test-api-error-not-found-json
test: migrate test api error not found json
2025-10-21 11:57:56 +02:00
Sebastiaan van Stijn
ebfcc6cf61 Merge pull request #51194 from thaJeztah/handle_macaddr
api/types/container: remove deprecated Config.MacAddress
2025-10-21 11:16:05 +02:00
Sameer Gupta
62a71a8261 test: migrate test api error not found json
Signed-off-by: Sameer Gupta <sameergupta4873@gmail.com>
2025-10-21 14:18:04 +05:30
Sebastiaan van Stijn
33fc45e5c5 libnetwork: EndpointInterface: cleanup marshal/unmarshal
Define an intermediate struct for marshaling/unmarshaling; this
struct already uses netip types (in case we want to migrate the
actual struct to use these types as well).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 10:37:05 +02:00
Sebastiaan van Stijn
461b8fe502 Merge pull request #51237 from vvoland/label-depsnomods
gha/labeler: Exclude client and api modules from dependencies label
2025-10-21 09:33:20 +02:00
Sebastiaan van Stijn
a8950e0192 api/types/container: remove deprecated Config.MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 09:15:26 +02:00
Sebastiaan van Stijn
79912d4c7f daemon: Daemon.getInspectData: move migration code to router
There also appeared to be duplication between daemon.getInspectData,
and the containerRouter.postContainersCreate methods, as both were
back-filling the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 09:15:18 +02:00
Sebastiaan van Stijn
91ce33d4b0 daemon/server/router/container: remove uses of deprecated MacAddress
Rewrite the router to use a local struct to unmarshal the deprecated
field for requests that send it, and adjust the adoption code.

There also appeared to be duplication between daemon.getInspectData,
and the containerRouter.postContainersCreate methods, as both were
back-filling the field.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
0030ba21e3 client: ContainerCreate: remove handling of legacy MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
e5864a51ac integration/networking: TestWatchtowerCreate: rewrite with request util
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
8088de791c integration/networking: TestInspectCfgdMAC: rewrite with request util
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Sebastiaan van Stijn
b4b0b6f10f integration/container: rewrite with request for MacAddress
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-21 08:33:42 +02:00
Austin Vazquez
0ad58d39a4 Merge pull request #51078 from vvoland/client-config-opts
client/config: Wrap results and options
2025-10-20 18:41:31 -05:00
Paweł Gronowski
762fc029f0 Merge pull request #51232 from dmcgowan/fix-container-os-migration
Move container platform migration logic
2025-10-20 23:52:48 +02:00
Paweł Gronowski
4b22807a0f gha/labeler: Exclude client and api modules from dependencies label
Prevent applying `area/dependencies` when the `client` and `api` modules
are changed.

Due to the replace rule present for these modules, we have to revendor
them with each change which would trigger the previous rule.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 23:47:35 +02:00
Paweł Gronowski
abf5679049 client/inspect: Better Raw handling
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Paweł Gronowski
ee22a50b75 client/config: Use Config instead of Spec as field
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Paweł Gronowski
f4b06e66e1 client/config: Wrap results and options
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2025-10-20 22:29:36 +02:00
Sebastiaan van Stijn
72e9c3af99 Merge pull request #51211 from austinvazquez/move-client-volume-create-options
api/types/volume: move `CreateOptions` to `client.VolumeCreateOptions`
2025-10-20 21:44:03 +02:00
Austin Vazquez
42ba5466c7 api: rename volumes.CreateOptions to volumes.CreateRequest
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 13:23:41 -05:00
Austin Vazquez
a2fd724453 client: wrap volume create api options with client options
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 12:55:52 -05:00
Derek McGowan
600edfe55c Move container platform migration logic
Defer the logic to fill in the container platform information from the
image service until container restore. During container restore the
image backend is fully initialized and can be used to fill in the
missing platform fields for older containers.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-10-20 10:39:16 -07:00
Sebastiaan van Stijn
2ba58d3c7f Merge pull request #51208 from thaJeztah/volume_prune_all
client: VolumePruneOptions: add "All" option
2025-10-20 19:04:36 +02:00
Sebastiaan van Stijn
acb67509e0 Merge pull request #51210 from austinvazquez/refactor-client-volume
client/volume: refactor volume options and responses
2025-10-20 18:59:42 +02:00
Austin Vazquez
d4e6d4f697 client/volume: refactor volume options and responses
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
2025-10-20 09:05:55 -05:00
Sebastiaan van Stijn
663aa7aeab Merge pull request #51224 from thaJeztah/datastore_cleanups
libnetwork/datastore: small cleanups
2025-10-20 15:51:18 +02:00
Sebastiaan van Stijn
2f09e6d6d8 Merge pull request #51184 from thaJeztah/remove_servicespec_networks
api/types/swarm: remove deprecated ServiceSpec.Networks field
2025-10-20 12:33:58 +02:00
Sebastiaan van Stijn
975e46f726 libnetwork/datastore: small cleanups
- Use an intermediate struct for (un)marshaling dummyObject
- Remove dummyObject.SkipSave as it would always be set to "false"
  (i.e., persisted to disk).
- Minor cleanups in handling locks and some unused vars

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 11:49:03 +02:00
Sebastiaan van Stijn
4a89449eab Merge pull request #51220 from thaJeztah/request_json_util
internal/testutil/request: add ReadJSONResponse utility
2025-10-20 11:39:05 +02:00
Sebastiaan van Stijn
10faa629fe libnetwork/drivers/macvlan, ipvlan: assorted minor cleanups
- Inline some vars and align between drivers
- Remove nested if's where possible
- Use `WithError` for some logs, and use the context if available
- Scope variables locally where only used locally and, the reverse,
  make it clear where a (function-)global variable is used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:52:09 +02:00
Sebastiaan van Stijn
a013147c40 libnetwork/drivers/macvlan: parentHasSingleUser: don't create copy of networks
This function was calling driver.getNetworks, which copies the networks map
into a new slice. As we're not mutating the networks, we can just use the
networks map itself to check if there's any networks configured with the
same parent.

While changing;

- Also change the signature to accept the parent to compare to as a string
- Return early once we determined there's more than one user

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:45 +02:00
Sebastiaan van Stijn
65296cd0e7 libnetwork/drivers/macvlan, ipvlan: un-embed mutexes
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
a2f4f09f91 libnetwork/drivers/macvlan, ipvlan: remove unused sync.Once
Both were added as part of the initial implementation in commit [moby@ea30113]
([libnetwork@1d6f2c5]), but never used.

[moby@ea30113]: ea30113303
[libnetwork@1d6f2c5]: 1d6f2c59c4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
5276dd8e9a libnetwork/drivers/ipvlan: remove ifaceGateway utility
This utility was only called with two constant values;

    const (
        defaultV4RouteCidr = "0.0.0.0/0"
        defaultV6RouteCidr = "::/0"
    )

However;

- calling it would always execute a `net.ParseCIDR`
- verify if it would produce an error (which would be very unlikely)
- it used a `staticRoute` struct that was ONLY used for this function
- and immediately deconstructed into its components
- furthermore, the `NextHop` field would be discarded by jinfo.AddStaticRoute,
  which only used the third argument for `routeType == types.NEXTHOP`

This patch:

- removes the `ifaceGateway` and associated `staticRoute` and consts
- defines two package-level vars for `defaultV4Net` and `defaultV6Net`,
  which can be reused (no need to parse / construct them for every join)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
d481c09fa7 libnetwork/drivers/macvlan, ipvlan: make driver.leave a stub
These drivers did not do anything meaningful in the `Leave` method; they
would check if the network and/or endpoint were missing, in which case
they produced an error, but the network and endpoint (if present) would
not be used, so it was only validation.

Such validation could still be relevant elsewhere, but looking at where
this method is called; the `Driver.Leave()` is called in two places, both
of which don't handle the error, other than logging it as a warning / error;

It's called by `Endpoint.sbJoin()`, as part of the rollback;
d5c838dc5e/daemon/libnetwork/endpoint.go (L539-L545)

And `Endpoint.sbLeave()`, which also discards the error;
d5c838dc5e/daemon/libnetwork/endpoint.go (L772-L776)

Based on he above, this code looks to be redundant, so replacing it with
a stub; returning `nil`.

As replacing the code removed the use of network.getEndpoint, which was effectively
a copy of network.endpoint (which didn't have error handling), I merged the two
methods, and removed custom error-handling elsewhere.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
aec6e7f7b6 libnetwork/drivers/macvlan, ipvlan: remove networkTable, endpointTable
These types were just a straight map[string]XXX, with no methods or other
properties attached.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:44 +02:00
Sebastiaan van Stijn
bf7277f8fe libnetwork/drivers/macvlan, ipvlan: remove getSubnetforIPv6, getSubnetforIPv4
These methods were just wrappers around getSubnetforIP; let's peel away the
abstraction and call it directly; we're already checking for n.config.Ipv4Subnet
and n.config.Ipv6Subnets on the call-site, so may as well just pass it in.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-20 08:14:34 +02:00
Sebastiaan van Stijn
a294445345 ibnetwork/drivers/macvlan, ipvlan: align and fix potential panic
There were some missing checks whether ep.addr, ep.addrv6 were nil,
which could panic in getSubnetForIP.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-19 13:35:25 +02:00
Sebastiaan van Stijn
17425cff08 libnetwork/drivers/macvlan, ipvlan: driver.Join: don't fetch endpoint twice
The function was fetching a reference to the endpoint twice; while this
did give the option for an early return, in practice it didn't mean much,
because it could still fail if the endpoint was removed in between.

This code still has a race condition, because while a reference to the
endpoint is retrieved while acquiring a lock, the result is mutated without.
This probably needs to either have some accessor, or the function should
keep a lock for the whole operation (possibly switching to an RWMutex).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-19 13:17:56 +02:00
Sebastiaan van Stijn
3906199019 internal/testutil/request: add ReadJSONResponse utility
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-18 22:15:31 +02:00
Sebastiaan van Stijn
5061d0a74d api/types/swarm: remove deprecated ServiceSpec.Networks field
This field was deprecated in [engine-api@5c4b684], which got vendored into
Moby in [moby@8f7a8c7] (API v1.25), and wired up in [moby@99a98cc].

[engine-api@5c4b684]: 5c4b684b2f
[moby@8f7a8c7]: 8f7a8c75ae
[moby@99a98cc]: 99a98ccc14

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 22:20:00 +02:00
Austin Vazquez
ec83dd46ed Merge pull request #51212 from thaJeztah/bump_docker_py
ci: update docker-py to main (v7.2.0-dev)
2025-10-17 15:11:31 -05:00
Sebastiaan van Stijn
acda47637c ci: update docker-py to main (v7.2.0-dev)
full diff: https://github.com/docker/docker-py/compare/7.1.0...65f7f0c772577beb5e2cd6daac4e5ca806ccc4af

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 18:46:44 +02:00
Sebastiaan van Stijn
6da63a3ed5 client: VolumePruneOptions: add "All" option
Abstract away that the "all" option is currently implemented as
a filter (which may change in future).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-10-17 17:40:01 +02:00
Sebastiaan van Stijn
d1a720cb15 Merge pull request #51042 from akerouanton/userns-remapping-disable-snapshotter
daemon/command: disable c8d snapshotter when userns remapping enabled
2025-10-17 17:21:31 +02:00