Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for endpoint-specific MAC address #11208

Merged
merged 1 commit into from Dec 18, 2023

Conversation

akerouanton
Copy link
Member

Related to:

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.

What I did

Related issue

(not mandatory) A picture of a cute animal, if possible in relation to what you did

@akerouanton akerouanton self-assigned this Nov 20, 2023
@glours glours requested a review from milas November 20, 2023 17:04
@akerouanton akerouanton marked this pull request as draft November 20, 2023 17:12
@akerouanton akerouanton force-pushed the endpoint-specific-mac-address branch 4 times, most recently from 71513d4 to 6db3b46 Compare November 21, 2023 10:31
Copy link
Contributor

@ndeloof ndeloof left a comment

Choose a reason for hiding this comment

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

LGTM, please rebase so we can merge


// TODO(aker): maybe show a warning and reset all mac_address fields except for the main endpoint?
if len(withMacAddress) > 1 {
return createConfigs{}, fmt.Errorf("a MAC address is specified for multiple networks (%s), but the target Docker Engine is too old to support that", strings.Join(withMacAddress, ", "))
Copy link
Contributor

Choose a reason for hiding this comment

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

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>
Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 20 lines in your changes are missing coverage. Please review.

Comparison is base (e4fb554) 56.20% compared to head (05c047d) 56.34%.

Files Patch % Lines
pkg/compose/create.go 51.21% 14 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11208      +/-   ##
==========================================
+ Coverage   56.20%   56.34%   +0.14%     
==========================================
  Files         134      134              
  Lines       11564    11604      +40     
==========================================
+ Hits         6499     6538      +39     
+ Misses       4421     4419       -2     
- Partials      644      647       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akerouanton akerouanton marked this pull request as ready for review December 18, 2023 10:58
@ndeloof ndeloof merged commit 785835b into docker:main Dec 18, 2023
26 checks passed
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

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

LGTM

@akerouanton akerouanton deleted the endpoint-specific-mac-address branch December 18, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants