Skip to content

Commit 4ed3d58

Browse files
author
Shikha Jhala
committed
CNV-37050: OVN-K secondary network IP address management
1 parent 639d7ab commit 4ed3d58

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

modules/virt-creating-layer2-nad-cli.adoc

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,22 @@ spec:
3030
"name": "my-namespace-l2-network", <2>
3131
"type": "ovn-k8s-cni-overlay", <3>
3232
"topology":"layer2", <4>
33-
"mtu": 1300, <5>
34-
"netAttachDefName": "my-namespace/l2-network" <6>
33+
"subnets": "192.168.10.0/29", <5>
34+
"mtu": 1300, <6>
35+
"netAttachDefName": "my-namespace/l2-network", <7>
36+
"excludeSubnets": "192.168.10.1/32, 192.168.10.2/32, 192.168.10.3/32, 192.168.10.4/32", <8>
37+
"allowPersistentIPs": "true" <9>
3538
}
3639
----
3740
<1> The CNI specification version. The required value is `0.3.1`.
3841
<2> The name of the network. This attribute is not namespaced. For example, you can have a network named `l2-network` referenced from two different `NetworkAttachmentDefinition` objects that exist in two different namespaces. This feature is useful to connect VMs in different namespaces.
3942
<3> The name of the CNI plug-in to be configured. The required value is `ovn-k8s-cni-overlay`.
4043
<4> The topological configuration for the network. The required value is `layer2`.
41-
<5> Optional: The maximum transmission unit (MTU) value. The default value is automatically set by the kernel.
42-
<6> The value of the `namespace` and `name` fields in the `metadata` stanza of the `NetworkAttachmentDefinition` object.
43-
+
44-
[NOTE]
45-
====
46-
The above example configures a cluster-wide overlay without a subnet defined. This means that the logical switch implementing the network only provides layer 2 communication. You must configure an IP address when you create the virtual machine by either setting a static IP address or by deploying a DHCP server on the network for a dynamic IP address.
47-
====
44+
<5> Optional: A comma-separated list of subnets. If you specify multiple subnets, IP addresses are assigned from each subnet. When the `subnets` field is omitted, the logical switch implementing the network only provides layer 2 communication. You must configure an IP address when you create the VM by either setting a static IP address or by deploying a DHCP server on the network for a dynamic IP address.
45+
<6> Optional: The maximum transmission unit (MTU) value. The default value is automatically set by the kernel.
46+
<7> The value of the `namespace` and `name` fields in the `metadata` stanza of the `NetworkAttachmentDefinition` object.
47+
<8> Optional: A comma-separated list of CIDRs and IP addresses. IP addresses are removed from the assignable IP address pool and are not passed to the pods.
48+
<9> Optional: When set to `true`, the assigned IP addresses persist of a VM connected to this secondary network persist in an `IPClaims` object after live migration These IP addresses are reused by other pods, if requested. This works only if the `subnets` attribute is also defined.
4849

4950
. Apply the manifest:
5051
+

modules/virt-creating-localnet-nad-cli.adoc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,20 @@ spec:
3232
"name": "localnet-network", <2>
3333
"type": "ovn-k8s-cni-overlay", <3>
3434
"topology": "localnet", <4>
35-
"netAttachDefName": "default/localnet-network" <5>
35+
"subnets": "192.168.10.0/29", <5>
36+
"netAttachDefName": "default/localnet-network", <6>
37+
"excludeSubnets": "192.168.10.1/32, 192.168.10.2/32, 192.168.10.3/32, 192.168.10.4/32", <7>
38+
"allowPersistentIPs": "true" <8>
3639
}
3740
----
3841
<1> The CNI specification version. The required value is `0.3.1`.
3942
<2> The name of the network. This attribute must match the value of the `spec.desiredState.ovn.bridge-mappings.localnet` field of the `NodeNetworkConfigurationPolicy` object that defines the OVS bridge mapping.
4043
<3> The name of the CNI plug-in to be configured. The required value is `ovn-k8s-cni-overlay`.
4144
<4> The topological configuration for the network. The required value is `localnet`.
42-
<5> The value of the `namespace` and `name` fields in the `metadata` stanza of the `NetworkAttachmentDefinition` object.
45+
<5> Optional: A comma-separated list of subnets. A VM connected to this secondary network interface is assigne an IP address from this pool. If you specify multiple subnets, IP addresses are assigned from each subnet.
46+
<6> The value of the `namespace` and `name` fields in the `metadata` stanza of the `NetworkAttachmentDefinition` object.
47+
<7> Optional: A comma-separated list of CIDRs and IP addresses. IP addresses are removed from the assignable IP address pool and are not passed to the pods.
48+
<8> Optional: When set to `true`, the assigned IP addresses persist of a VM connected to this secondary network persist in an `IPClaims` object after live migration. These IP addresses are reused by other pods, if requested. This works only if the `subnets` attribute is also defined.
4349

4450
. Apply the manifest:
4551
+

virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ endif::openshift-rosa,openshift-dedicated[]
3535
[id="creating-ovn-nad_{context}"]
3636
== Creating an OVN-Kubernetes NAD
3737

38-
You can create an OVN-Kubernetes layer 2 or localnet network attachment definition (NAD) by using the {product-title} web console or the CLI.
38+
You can create an OVN-Kubernetes layer 2 or localnet network attachment definition (NAD) by using the {product-title} web console or the CLI. For both layer 2 and localnet topologies, you can configure IP address management (IPAM) in a NAD for virtual machines. Hot plugging and hot unplugging is not supported for interfaces that use IPAM.
3939

40-
[NOTE]
41-
====
42-
Configuring IP address management (IPAM) in a network attachment definition for virtual machines is not supported.
43-
====
40+
:FeatureName: Configuring IPAM in a network attachment definition for VMs
41+
include::snippets/technology-preview.adoc[]
4442

4543
include::modules/virt-creating-layer2-nad-cli.adoc[leveloffset=+2]
4644

0 commit comments

Comments
 (0)