Skip to content

api/t/ctr: drop NetworkSettingsBase, DefaultNetworkSettings#50846

Merged
thaJeztah merged 2 commits intomoby:masterfrom
akerouanton:drop-deprecated-network-structs
Sep 11, 2025
Merged

api/t/ctr: drop NetworkSettingsBase, DefaultNetworkSettings#50846
thaJeztah merged 2 commits intomoby:masterfrom
akerouanton:drop-deprecated-network-structs

Conversation

@akerouanton
Copy link
Member

@akerouanton akerouanton commented Aug 29, 2025

- What I did

These structs were deprecated in v28.4, and are now fully removed. The few fields in NetworkSettingsBase that were not deprecated are moved to NetworkSettings.

- Human readable description for the release notes

- Go-SDK: Remove structs `NetworkSettingsBase` and `DefaultNetworkSettings`. Fields in `NetworkSettingsBase` that were not deprecated are now directly in `NetworkSettings`

@akerouanton akerouanton added this to the 29.0.0 milestone Aug 29, 2025
@akerouanton akerouanton self-assigned this Aug 29, 2025
@akerouanton akerouanton added area/api API status/2-code-review area/networking Networking kind/refactor PR's that refactor, or clean-up code impact/go-sdk Noteworthy (compatibility changes) in the Go SDK labels Aug 29, 2025
@akerouanton akerouanton force-pushed the drop-deprecated-network-structs branch 6 times, most recently from 1178025 to 80416bf Compare August 29, 2025 16:39
@akerouanton akerouanton marked this pull request as ready for review September 1, 2025 09:55
@akerouanton akerouanton requested a review from tianon as a code owner September 1, 2025 09:55
@thaJeztah
Copy link
Member

@akerouanton this needs a rebase now

@akerouanton
Copy link
Member Author

@robmry asked privately about dropped fields not being returned for older API versions we still support. So here's a summury of when every field was deprecated, etc…

Go Field Deprecated in API Deprecated in Release Description
NetworkSettingsBase v28.4.0
NetworkSettingsBase.Bridge v1.51 v28.4.0 Set when dockerd is started with --bridge and the container is connected to the default bridge network
NetworkSettingsBase.HairpinMode v1.44 v25.0 Never set.
NetworkSettingsBase.LinkLocalIPv6Address v1.44 v25.0 Ditto
NetworkSettingsBase.LinkLocalIPv6PrefixLen v1.44 v25.0 Ditto
NetworkSettingsBase.SecondaryIPAddresses v1.44 v25.0 Ditto
NetworkSettingsBase.SecondaryIPv6Addresses v1.44 v25.0 Ditto
DefaultNetworkSettings v1.9 Was scheduled for removal in v1.11, but never removed. Go deprecation badly formatted until v28.4.0.
DefaultNetworkSettings.EndpointID v1.21 v1.9 Was scheduled for removal in v1.11, but never removed. No deprecation warning in the API docs before v17.09. API docs say that it should be removed in v17.12. No Go deprecation warning before v28.4.0.
DefaultNetworkSettings.Gateway v1.21 v1.9 Ditto
DefaultNetworkSettings.GlobaIPv6Address v1.21 v1.9 Ditto
DefaultNetworkSettings.GlobalIPv6PrefixLen v1.21 v1.9 Ditto
DefaultNetworkSettings.IPAddress v1.21 v1.9 Ditto
DefaultNetworkSettings.IPPrefixLen v1.21 v1.9 Ditto
DefaultNetworkSettings.IPv6Gateway v1.21 v1.9 Ditto
DefaultNetworkSettings.MacAddress v1.21 v1.9 Ditto

@akerouanton akerouanton force-pushed the drop-deprecated-network-structs branch from 288b4f1 to 631d45a Compare September 8, 2025 14:53
@akerouanton akerouanton force-pushed the drop-deprecated-network-structs branch from 631d45a to 0685927 Compare September 10, 2025 14:44
@akerouanton akerouanton marked this pull request as draft September 10, 2025 15:03
@akerouanton

This comment was marked as outdated.

@corhere corhere mentioned this pull request Sep 9, 2025
20 tasks
@akerouanton akerouanton force-pushed the drop-deprecated-network-structs branch 2 times, most recently from f3392ee to 26942ec Compare September 10, 2025 21:35
@akerouanton akerouanton force-pushed the drop-deprecated-network-structs branch from 26942ec to 90dd0fe Compare September 11, 2025 07:35
All the fields in DefaultNetworkSettings were deprecated in Engine v1.9
and scheduled for removal in v17.12. However, they're still return in
all supported API versions.

As we still need to keep backward compatibility for older API versions,
this change leverages the newly added 'compat' package to return these
fields despite being removed from the Go struct.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
Except Bridge, all fields of NetworkSettingsBase were deprecated in
v1.44, and are actually never set at all.

The Bridge field was deprecated in v1.51 but it's only set when the
container is connected to the default bridge, and when the daemon is
started with the --bridge option set.

So, remove all those fields and do not backfill them for older API
versions.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
@akerouanton akerouanton force-pushed the drop-deprecated-network-structs branch from 90dd0fe to b092c8c Compare September 11, 2025 15:57
@akerouanton akerouanton marked this pull request as ready for review September 11, 2025 18:12
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'll do a quick follow-up to sync the v1.52 swagger

@thaJeztah thaJeztah added the release-blocker PRs we want to block a release on label Sep 11, 2025
@thaJeztah thaJeztah merged commit 1e6e2ce into moby:master Sep 11, 2025
214 of 215 checks passed
@akerouanton akerouanton deleted the drop-deprecated-network-structs branch September 11, 2025 20:15
@akerouanton
Copy link
Member Author

I'll do a quick follow-up to sync the v1.52 swagger

Oh right, we've the 1.52 swagger file already in api/docs. I'm wondering if we should have a CI check for that, or make that copy part of the 'prepare release' procedure instead of doing it semi-randomly some time before the release.

@thaJeztah
Copy link
Member

Yeah, we probably should; usually we don't cut off the versioned file until it's ready to do the release, but with all the module work, we did that early.

I didn't get round to open that PR yet; feel free to open one if you have time.

I think we should also repeat the deprecation in the v1.52 changelog; add a bullet that the fields that were deprecated have now been removed from the API response (to be crystal clear they're gone now), wdyt? @akerouanton

koeleco pushed a commit to TOPdesk/pytest-docker-network-fixtures that referenced this pull request Nov 17, 2025
Docker v29 removes the top-level NetworkSettings.IPAddress field; IP
addresses are now only available under NetworkSettings.Networks.
Fallback to the bridge network entry if the legacy key is absent.

See moby/moby#50846

Other changes
* Add myself to the authors list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api API area/networking Networking impact/go-sdk Noteworthy (compatibility changes) in the Go SDK kind/refactor PR's that refactor, or clean-up code release-blocker PRs we want to block a release on status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants