Skip to content

Conversation

akerouanton
Copy link
Member

@akerouanton akerouanton commented Jul 7, 2023

Fix:

Related to:

- What I did

  • Add a new MacAddress field to EndpointSettings ;
  • Deprecate the old MacAddress in container's Config ;

- Description for the changelog

A MAC address can now be specified per-endpoint when creating a container.

- A picture of a cute animal (not mandatory but encouraged)

@akerouanton akerouanton added area/api API status/2-code-review kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. area/networking Networking impact/api impact/changelog labels Jul 7, 2023
@akerouanton akerouanton added this to the 25.0.0 milestone Jul 7, 2023
@akerouanton akerouanton force-pushed the endpoint-specific-mac-address branch from ffa33a0 to 258958a Compare July 7, 2023 17:11
@akerouanton akerouanton marked this pull request as draft July 7, 2023 17:16
@akerouanton akerouanton force-pushed the endpoint-specific-mac-address branch from 258958a to 58bf4e5 Compare July 7, 2023 17:22
@akerouanton akerouanton marked this pull request as ready for review July 7, 2023 18:01
@akerouanton akerouanton force-pushed the endpoint-specific-mac-address branch 3 times, most recently from 739a26a to b9df778 Compare July 13, 2023 12:18
@akerouanton akerouanton mentioned this pull request Jul 27, 2023
26 tasks
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.

Yikes... looks like I didn't submit my review 🙈 😂
Screenshot 2023-08-01 at 16 47 58

@@ -608,6 +609,19 @@ func (s *containerRouter) postContainersCreate(ctx context.Context, w http.Respo
}
}

if config != nil && versions.LessThan(version, "1.44") {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to make changes in the swarm (service create, service update, service inspect) endpoints as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, as well as the Compose specification. I have WIP branches for that, but other PRs I created in the past few weeks will also need to update the swarmkit protobuf. So, I'll do that in follow-up PRs.

@thaJeztah
Copy link
Member

@thaJeztah
Copy link
Member

OOHH.... no it was more fun... I posted my review comments here (but didn't submit) and accidentally submitted "a review" on the CLI PR related to this docker/cli#4419 (review) 😂

Guess I had the wrong tab open when I did.

OHMAN this one is complicated I tried to make changes what I (think) is needed while reviewing, and opened a PR;

However, it may need checking, and there's some other comments I left (including "migrating containers during restore"), > which I didn't look into yet.

akerouanton added a commit to akerouanton/cli that referenced this pull request Aug 10, 2023
Following flags are silently ignored when they're passed with no
`--network` specified (ie. when the default network is used):

- `--network-alias`
- `--ip`
- `--ip6`
- `--link-local-ip`

This is not really an issue right now since the first 3 parameters are
not allowed on the default bridge network. However, with
[moby/moby#45905][1], the container-wide MacAddress parameter will be
deprecated and dismissed.

Because of that, with [docker#4419][2], it's currently not possible
to use the `--mac-address` flag for the default network.

Morever, `docker network connect --link-local-ip ...` works properly, so
it should also work on `docker container create`. This also lay the
ground for making the default bridge network just a "normal" network.

[1]: moby/moby#45905
[2]: docker#4419

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/cli that referenced this pull request Aug 10, 2023
Following flags are silently ignored when they're passed with no
`--network` specified (ie. when the default network is used):

- `--network-alias`
- `--ip`
- `--ip6`
- `--link-local-ip`

This is not really an issue right now since the first 3 parameters are
not allowed on the default bridge network. However, with
[moby/moby#45905][1], the container-wide MacAddress parameter will be
deprecated and dismissed. Because of that, with [docker#4419][2],
it's currently not possible to use the `--mac-address` flag with no
default network specified.

Morever, `docker network connect --link-local-ip ...` works properly, so
it should also work on `docker container create`. This also lay the
ground for making the default bridge network just a "normal" network.

[1]: moby/moby#45905
[2]: docker#4419

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/cli that referenced this pull request Aug 10, 2023
Following flags are silently ignored when they're passed with no
`--network` specified (ie. when the default network is used):

- `--network-alias`
- `--ip`
- `--ip6`
- `--link-local-ip`

This is not really an issue right now since the first 3 parameters are
not allowed on the default bridge network. However, with
[moby/moby#45905][1], the container-wide MacAddress parameter will be
deprecated and dismissed. Because of that, with [docker#4419][2],
it's currently not possible to use the `--mac-address` flag with no
default network specified.

Morever, `docker network connect --link-local-ip ...` works properly, so
it should also work on `docker container create`. This also lay the
ground for making the default bridge network just a "normal" network.

Since the 3 parameters in the list above aren't ignored anymore, if
users provide them, moby's ContainerStart endpoint will complain about
those. To provide better UX, [moby/moby#46183][3] make sure these
invalid parameters lead to a proper error message on `docker container
create` / `docker run`.

[1]: moby/moby#45905
[2]: docker#4419
[3]: moby/moby#46183

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/cli that referenced this pull request Aug 18, 2023
Following flags are silently ignored when they're passed with no
`--network` specified (ie. when the default network is used):

- `--network-alias`
- `--ip`
- `--ip6`
- `--link-local-ip`

This is not really an issue right now since the first 3 parameters are
not allowed on the default bridge network. However, with
[moby/moby#45905][1], the container-wide MacAddress parameter will be
deprecated and dismissed. Because of that, with [docker#4419][2],
it's currently not possible to use the `--mac-address` flag with no
default network specified.

Morever, `docker network connect --link-local-ip ...` works properly, so
it should also work on `docker container create`. This also lay the
ground for making the default bridge network just a "normal" network.

Since the 3 parameters in the list above aren't ignored anymore, if
users provide them, moby's ContainerStart endpoint will complain about
those. To provide better UX, [moby/moby#46183][3] make sure these
invalid parameters lead to a proper error message on `docker container
create` / `docker run`.

[1]: moby/moby#45905
[2]: docker#4419
[3]: moby/moby#46183

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/cli that referenced this pull request Sep 10, 2023
Following flags are silently ignored when they're passed with no
`--network` specified (ie. when the default network is used):

- `--network-alias`
- `--ip`
- `--ip6`
- `--link-local-ip`

This is not really an issue right now since the first 3 parameters are
not allowed on the default bridge network. However, with
[moby/moby#45905][1], the container-wide MacAddress parameter will be
deprecated and dismissed. Because of that, with [docker#4419][2],
it's currently not possible to use the `--mac-address` flag with no
default network specified.

Morever, `docker network connect --link-local-ip ...` works properly, so
it should also work on `docker container create`. This also lay the
ground for making the default bridge network just a "normal" network.

Since the 3 parameters in the list above aren't ignored anymore, if
users provide them, moby's ContainerStart endpoint will complain about
those. To provide better UX, [moby/moby#46183][3] make sure these
invalid parameters lead to a proper error message on `docker container
create` / `docker run`.

[1]: moby/moby#45905
[2]: docker#4419
[3]: moby/moby#46183

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
@thaJeztah
Copy link
Member

Let me bring this one in

@thaJeztah thaJeztah merged commit 49cea49 into moby:master Nov 7, 2023
@akerouanton akerouanton deleted the endpoint-specific-mac-address branch November 7, 2023 17:00
akerouanton added a commit to akerouanton/compose-spec that referenced this pull request Nov 8, 2023
Since moby/moby#45905 has been merged (will be
part of the upcoming v25 release), it's now possible to specify an
endpoint-specific MAC address. Moreover, setting the container-wide MAC
address will return a warning.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose-go that referenced this pull request Nov 20, 2023
Related to:

- moby/moby#45905
- compose-spec/compose-spec#435

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose-spec that referenced this pull request Nov 20, 2023
Since moby/moby#45905 has been merged (will be
part of the upcoming v25 release), it's now possible to specify an
endpoint-specific MAC address. Moreover, setting the container-wide MAC
address will return a warning.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose-go that referenced this pull request Nov 20, 2023
Related to:

- moby/moby#45905
- compose-spec/compose-spec#435

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose-spec that referenced this pull request Nov 20, 2023
Since moby/moby#45905 has been merged (will be
part of the upcoming v25 release), it's now possible to specify an
endpoint-specific MAC address. Moreover, setting the container-wide MAC
address will return a warning.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
glours pushed a commit to akerouanton/compose-spec that referenced this pull request Nov 20, 2023
Since moby/moby#45905 has been merged (will be
part of the upcoming v25 release), it's now possible to specify an
endpoint-specific MAC address. Moreover, setting the container-wide MAC
address will return a warning.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose-spec that referenced this pull request Nov 20, 2023
Since moby/moby#45905 has been merged (will be
part of the upcoming v25 release), it's now possible to specify an
endpoint-specific MAC address. Moreover, setting the container-wide MAC
address will return a warning.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose that referenced this pull request Nov 20, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose that referenced this pull request Nov 20, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose that referenced this pull request Nov 21, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose that referenced this pull request Nov 21, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose that referenced this pull request Nov 21, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
akerouanton added a commit to akerouanton/compose that referenced this pull request Dec 18, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
ndeloof pushed a commit to docker/compose that referenced this pull request Dec 18, 2023
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
temenuzhka-thede pushed a commit to temenuzhka-thede/compose that referenced this pull request Sep 17, 2024
Related to:

- compose-spec/compose-spec#435
- moby/moby#45905

Since API v1.44, Moby supports a per-endpoint MAC address and returns a
warning when the container-wide mac_address field is set.

A corresponding field has been added to compose-spec and compose-go, so
we need to leverage it to set the right API field.

This commit is backward-compatible with compose files that still set the
container-wide mac_address field, and older API versions that don't know
about the endpoint-specific MAC address field.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
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/api impact/changelog kind/enhancement Enhancements are not bugs or new features but can improve usability or performance. status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Set mac address for multiple network interfaces
3 participants