1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/nw-multus-macvlan-object.adoc
Yuval Kashtan 83e9a158f4 reorder macvlan CNI explanation correctly
Signed-off-by: Yuval Kashtan <yuvalkashtan@gmail.com>
2020-07-15 18:45:10 +03:00

162 lines
4.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * networking/multiple_networks/configuring-macvlan.adoc
ifeval::["{context}" == "configuring-macvlan-basic"]
:yaml:
endif::[]
// This is necessary for Whereabouts CNI which is JSON-only
ifeval::["{context}" == "configuring-macvlan"]
:json:
endif::[]
// Content duplicated because the callouts are identical
// and must be changed simultaneously if edited. The numbers
// do not easily line up, so the content is duplicated in each section.
[id="nw-multus-macvlan-object_{context}"]
= Configuration for macvlan CNI plug-in
ifdef::json[]
The configuration for an additional network attachment that uses the macvlan
Container Network Interface (CNI) plug-in is provided in two parts:
* Cluster Network Operator (CNO) configuration
* CNI plug-in configuration
The CNO configuration specifies the name for the additional network attachment
and the namespace to create the attachment in. The plug-in
is configured by a JSON object specified by the `rawCNIConfig` parameter in
the CNO configuration.
The following YAML describes the configuration parameters for the CNO:
.Cluster Network Operator YAML configuration
[source,yaml]
----
name: <name> <1>
namespace: <namespace> <2>
rawCNIConfig: '{ <3>
...
}'
type: Raw
----
<1> Specify a name for the additional network attachment that you are
creating. The name must be unique within the specified `namespace`.
<2> Specify the namespace to create the network attachment in. If
you do not specify a value, then the `default` namespace is used.
<3> Specify the CNI plug-in configuration in JSON format, which
is based on the following template.
The following object describes the configuration parameters for the macvlan CNI
plug-in:
.macvlan CNI plug-in JSON configuration object
[source,json]
----
{
"cniVersion": "0.3.1",
"name": "<name>", <1>
"type": "macvlan",
"mode": "<mode>", <2>
"master": "<master>", <3>
"mtu": <mtu>, <4>
"ipam": { <5>
...
}
}
----
<1> Specify a name for the additional network attachment that you are creating. The name must be unique within the specified `namespace`.
<2> Configures traffic visibility on the virtual network. Must be either `bridge`, `passthru`, `private`, or `vepa`. If a value is not provided, the default value is `bridge`.
<3> The ethernet interface to associate with the virtual interface. If a value is not specified, then the host system's primary ethernet interface is used.
<4> Set the maximum transmission unit (MTU) to the specified value. The default value is automatically set by the kernel.
<5> Specify a configuration object for the ipam CNI plug-in. The plug-in manages IP address assignment for the attachment definition.
endif::json[]
ifdef::yaml[]
The following YAML describes the configuration parameters for the macvlan
Container Network Interface (CNI) plug-in:
.macvlan YAML configuration
[source,yaml]
----
name: <name> <1>
namespace: <namespace> <2>
type: SimpleMacvlan
simpleMacvlanConfig:
master: <master> <3>
mode: <mode> <4>
mtu: <mtu> <5>
ipamConfig: <6>
...
----
<1> Specify a name for the additional network attachment that you are
creating. The name must be unique within the specified `namespace`.
<2> Specify the namespace to create the network attachment in. If
a value is not specified, the `default` namespace is used.
<3> The ethernet interface to associate with the virtual interface. If
a value for `master` is not specified, then the host system's primary ethernet
interface is used.
<4> Configures traffic visibility on the virtual network. Must be either
`bridge`, `passthru`, `private`, or `vepa`. If a value for `mode` is not
provided, the default value is `bridge`.
<5> Set the maximum transmission unit (MTU) to the specified value. The
default value is automatically set by the kernel.
<6> Specify a configuration object for the ipam CNI plug-in. The
plug-in manages IP address assignment for the attachment definition.
endif::yaml[]
[id="nw-multus-macvlan-config-example_{context}"]
== macvlan configuration example
The following example configures an additional network named `macvlan-net`:
ifdef::yaml[]
[source,yaml]
----
name: macvlan-net
namespace: work-network
type: SimpleMacvlan
simpleMacvlanConfig:
ipamConfig:
type: DHCP
----
endif::yaml[]
ifdef::json[]
[source,yaml]
----
name: macvlan-net
namespace: work-network
type: Raw
rawCNIConfig: |-
{
"cniVersion": "0.3.1",
"name": "macvlan-net",
"type": "macvlan",
"master": "eth1",
"mode": "bridge",
"ipam": {
"type": "dhcp"
}
}
----
endif::json[]
ifeval::["{context}" == "configuring-macvlan-basic"]
:!yaml:
endif::[]
ifeval::["{context}" == "configuring-macvlan"]
:!json:
endif::[]