client: ContainerCreate: remove handling of legacy MacAddress

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-15 17:16:00 +02:00
parent e5864a51ac
commit 0030ba21e3
2 changed files with 0 additions and 40 deletions

View File

@@ -11,7 +11,6 @@ import (
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/versions"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -29,25 +28,6 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
hostConfig.CapDrop = normalizeCapabilities(hostConfig.CapDrop)
}
// FIXME(thaJeztah): remove this once we updated our (integration) tests;
// some integration tests depend on this to test old API versions; see https://github.com/moby/moby/pull/51120#issuecomment-3376224865
if config.MacAddress != "" { //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44.
// Make sure we negotiated (if the client is configured to do so),
// as code below contains API-version specific handling of options.
//
// Normally, version-negotiation (if enabled) would not happen until
// the API request is made.
if err := cli.checkVersion(ctx); err != nil {
return response, err
}
if versions.GreaterThanOrEqualTo(cli.ClientVersion(), "1.44") {
// Since API 1.44, the container-wide MacAddress is deprecated and triggers a WARNING if it's specified.
//
// FIXME(thaJeztah): remove the field from the API
config.MacAddress = "" //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44.
}
}
query := url.Values{}
if platform != nil {
if p := formatPlatform(*platform); p != "unknown" {

View File

@@ -11,7 +11,6 @@ import (
cerrdefs "github.com/containerd/errdefs"
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/api/types/versions"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -29,25 +28,6 @@ func (cli *Client) ContainerCreate(ctx context.Context, config *container.Config
hostConfig.CapDrop = normalizeCapabilities(hostConfig.CapDrop)
}
// FIXME(thaJeztah): remove this once we updated our (integration) tests;
// some integration tests depend on this to test old API versions; see https://github.com/moby/moby/pull/51120#issuecomment-3376224865
if config.MacAddress != "" { //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44.
// Make sure we negotiated (if the client is configured to do so),
// as code below contains API-version specific handling of options.
//
// Normally, version-negotiation (if enabled) would not happen until
// the API request is made.
if err := cli.checkVersion(ctx); err != nil {
return response, err
}
if versions.GreaterThanOrEqualTo(cli.ClientVersion(), "1.44") {
// Since API 1.44, the container-wide MacAddress is deprecated and triggers a WARNING if it's specified.
//
// FIXME(thaJeztah): remove the field from the API
config.MacAddress = "" //nolint:staticcheck // ignore SA1019: field is deprecated, but still used on API < v1.44.
}
}
query := url.Values{}
if platform != nil {
if p := formatPlatform(*platform); p != "unknown" {