Skip to content

Port macvlan network documentation to gendoc #2042

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

Merged
merged 3 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions doc/config_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3430,6 +3430,43 @@ User keys can be used in search.
```

<!-- config group network_load_balancer-common end -->
<!-- config group network_macvlan-common start -->
```{config:option} gvrp network_macvlan-common
:condition: "-"
:default: "`false`"
:shortdesc: "Register VLAN using GARP VLAN Registration Protocol"
:type: "bool"

```

```{config:option} mtu network_macvlan-common
:condition: "-"
:shortdesc: "The MTU of the new interface"
:type: "int"

```

```{config:option} parent network_macvlan-common
:condition: "-"
:shortdesc: "Parent interface to create macvlan NICs on"
:type: "string"

```

```{config:option} user.* network_macvlan-common
:shortdesc: "User-provided free-form key/value pairs"
:type: "string"

```

```{config:option} vlan network_macvlan-common
:condition: "-"
:shortdesc: "The VLAN ID to attach to"
:type: "int"

```

<!-- config group network_macvlan-common end -->
<!-- config group network_ovn-common start -->
```{config:option} bridge.external_interfaces network_ovn-common
:shortdesc: "Comma-separated list of unconfigured network interfaces to include in the bridge"
Expand Down
12 changes: 5 additions & 7 deletions doc/reference/network_macvlan.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ The following configuration key namespaces are currently supported for the `macv

The following configuration options are available for the `macvlan` network type:

Key | Type | Condition | Default | Description
:-- | :-- | :-- | :-- | :--
`gvrp` | bool | - | `false` | Register VLAN using GARP VLAN Registration Protocol
`mtu` | integer | - | - | The MTU of the new interface
`parent` | string | - | - | Parent interface to create `macvlan` NICs on
`vlan` | integer | - | - | The VLAN ID to attach to
`user.*` | string | - | - | User-provided free-form key/value pairs
% Include content from [config_options.txt](../config_options.txt)
```{include} ../config_options.txt
:start-after: <!-- config group network_macvlan-common start -->
:end-before: <!-- config group network_macvlan-common end -->
```
46 changes: 46 additions & 0 deletions internal/server/metadata/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -3880,6 +3880,52 @@
]
}
},
"network_macvlan": {
"common": {
"keys": [
{
"gvrp": {
"condition": "-",
"default": "`false`",
"longdesc": "",
"shortdesc": "Register VLAN using GARP VLAN Registration Protocol",
"type": "bool"
}
},
{
"mtu": {
"condition": "-",
"longdesc": "",
"shortdesc": "The MTU of the new interface",
"type": "int"
}
},
{
"parent": {
"condition": "-",
"longdesc": "",
"shortdesc": "Parent interface to create macvlan NICs on",
"type": "string"
}
},
{
"user.*": {
"longdesc": "",
"shortdesc": "User-provided free-form key/value pairs",
"type": "string"
}
},
{
"vlan": {
"condition": "-",
"longdesc": "",
"shortdesc": "The VLAN ID to attach to",
"type": "int"
}
}
]
}
},
"network_ovn": {
"common": {
"keys": [
Expand Down
34 changes: 34 additions & 0 deletions internal/server/network/driver_macvlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,44 @@ func (n *macvlan) DBType() db.NetworkType {
// Validate network config.
func (n *macvlan) Validate(config map[string]string) error {
rules := map[string]func(value string) error{
// gendoc:generate(entity=network_macvlan, group=common, key=parent)
//
// ---
// type: string
// condition: -
// shortdesc: Parent interface to create macvlan NICs on
"parent": validate.Required(validate.IsNotEmpty, validate.IsInterfaceName),

// gendoc:generate(entity=network_macvlan, group=common, key=mtu)
//
// ---
// type: int
// condition: -
// shortdesc: The MTU of the new interface
"mtu": validate.Optional(validate.IsNetworkMTU),

// gendoc:generate(entity=network_macvlan, group=common, key=vlan)
//
// ---
// type: int
// condition: -
// shortdesc: The VLAN ID to attach to
"vlan": validate.Optional(validate.IsNetworkVLAN),

// gendoc:generate(entity=network_macvlan, group=common, key=gvrp)
//
// ---
// type: bool
// condition: -
// default: `false`
// shortdesc: Register VLAN using GARP VLAN Registration Protocol
"gvrp": validate.Optional(validate.IsBool),

// gendoc:generate(entity=network_macvlan, group=common, key=user.*)
//
// ---
// type: string
// shortdesc: User-provided free-form key/value pairs
}

err := n.validate(config, rules)
Expand Down