Skip to content

Commit

Permalink
Add a network-scoped mac_address field
Browse files Browse the repository at this point in the history
Related to:

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

Signed-off-by: Albin Kerouanton <[email protected]>
  • Loading branch information
akerouanton committed Nov 20, 2023
1 parent e058570 commit 973331b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions loader/full-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ services:
other-network:
ipv4_address: 172.16.238.10
ipv6_address: 2001:3984:3989::10
mac_address: 02:42:72:98:65:08
other-other-network:

pid: "host"
Expand Down
4 changes: 3 additions & 1 deletion loader/full-struct_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ services:
other-network:
ipv4_address: 172.16.238.10
ipv6_address: 2001:3984:3989::10
mac_address: 02:42:72:98:65:08
other-other-network: null
some-network:
aliases:
Expand Down Expand Up @@ -1392,7 +1393,8 @@ func fullExampleJSON(workingDir, homeDir string) string {
"networks": {
"other-network": {
"ipv4_address": "172.16.238.10",
"ipv6_address": "2001:3984:3989::10"
"ipv6_address": "2001:3984:3989::10",
"mac_address": "02:42:72:98:65:08"
},
"other-other-network": null,
"some-network": {
Expand Down
6 changes: 5 additions & 1 deletion schema/compose-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@
"additionalProperties": false,
"patternProperties": {"^x-": {}}
},
"mac_address": {"type": "string"},
"mac_address": {
"type": "string",
"deprecated": true
},
"mem_limit": {"type": ["number", "string"]},
"mem_reservation": {"type": ["string", "integer"]},
"mem_swappiness": {"type": "integer"},
Expand All @@ -294,6 +297,7 @@
"ipv4_address": {"type": "string"},
"ipv6_address": {"type": "string"},
"link_local_ips": {"$ref": "#/definitions/list_of_strings"},
"mac_address": {"type": "string"},
"priority": {"type": "number"}
},
"additionalProperties": false,
Expand Down
3 changes: 2 additions & 1 deletion types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ type ServiceConfig struct {
MemReservation UnitBytes `yaml:"mem_reservation,omitempty" json:"mem_reservation,omitempty"`
MemSwapLimit UnitBytes `yaml:"memswap_limit,omitempty" json:"memswap_limit,omitempty"`
MemSwappiness UnitBytes `yaml:"mem_swappiness,omitempty" json:"mem_swappiness,omitempty"`
MacAddress string `yaml:"mac_address,omitempty" json:"mac_address,omitempty"`
MacAddress string `yaml:"mac_address,omitempty" json:"mac_address,omitempty"` // Deprecated: [ServiceNetworkConfig.MacAddress] should be used instead
Net string `yaml:"net,omitempty" json:"net,omitempty"`
NetworkMode string `yaml:"network_mode,omitempty" json:"network_mode,omitempty"`
Networks map[string]*ServiceNetworkConfig `yaml:"networks,omitempty" json:"networks,omitempty"`
Expand Down Expand Up @@ -419,6 +419,7 @@ type ServiceNetworkConfig struct {
Ipv4Address string `yaml:"ipv4_address,omitempty" json:"ipv4_address,omitempty"`
Ipv6Address string `yaml:"ipv6_address,omitempty" json:"ipv6_address,omitempty"`
LinkLocalIPs []string `yaml:"link_local_ips,omitempty" json:"link_local_ips,omitempty"`
MacAddress string `yaml:"mac_address,omitempty" json:"mac_address,omitempty"`

Extensions Extensions `yaml:"#extensions,inline" json:"-"`
}
Expand Down

0 comments on commit 973331b

Please sign in to comment.