Skip to content

Commit 9486d04

Browse files
author
Shikha Jhala
committed
CNV-37050: OVN-K secondary network IP address management
1 parent b6ee264 commit 9486d04

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
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": "10.100.200.0/24", <5>
34+
"mtu": 1300, <6>
35+
"netAttachDefName": "my-namespace/l2-network", <7>
36+
"excludeSubnets": "10.100.200.0/29" , <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 in an `IPClaims` object. 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": "202.10.130.112/28", <5>
36+
"netAttachDefName": "default/localnet-network", <6>
37+
"excludeSubnets": "10.100.200.0/29", <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. 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 in an `IPClaims` object. 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: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ endif::openshift-rosa,openshift-dedicated[]
2121

2222
To configure an OVN-Kubernetes secondary network and attach a VM to that network, perform the following steps:
2323

24-
. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#virt-connecting-vm-to-ovn-secondary-network[Configure an OVN-Kubernetes secondary network] by creating a network attachment definition (NAD).
24+
. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#creating-ovn-nad_virt-connecting-vm-to-ovn-secondary-network[Configure an OVN-Kubernetes secondary network] by creating a network attachment definition (NAD).
2525
ifndef::openshift-rosa,openshift-dedicated[]
2626
+
2727
[NOTE]
@@ -30,17 +30,16 @@ For localnet topology, you must xref:../../networking/multiple_networks/configur
3030
====
3131
endif::openshift-rosa,openshift-dedicated[]
3232

33-
. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#attaching-vm-to-ovn-secondary-nw[Connect the VM to the OVN-Kubernetes secondary network] by adding the network details to the VM specification.
33+
. xref:../../virt/vm_networking/virt-connecting-vm-to-ovn-secondary-network.adoc#virt-attaching-vm-to-ovn-secondary-nw-cli_virt-connecting-vm-to-ovn-secondary-network[Connect the VM to the OVN-Kubernetes secondary network] by adding the network details to the VM specification.
3434

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+
41+
:FeatureName: Configuring IPAM in a network attachment definition for VMs
42+
include::snippets/technology-preview.adoc[]
4443

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

@@ -50,7 +49,7 @@ include::modules/virt-creating-nad-l2-overlay-console.adoc[leveloffset=+2]
5049

5150
include::modules/virt-creating-nad-localnet-console.adoc[leveloffset=+2]
5251

53-
[id="attaching-vm-to-ovn-secondary-nw"]
52+
[id="attaching-vm-to-ovn-secondary-nw_{context}"]
5453
== Attaching a virtual machine to the OVN-Kubernetes secondary network
5554

5655
You can attach a virtual machine (VM) to the OVN-Kubernetes secondary network interface by using the {product-title} web console or the CLI.
@@ -60,7 +59,7 @@ include::modules/virt-attaching-vm-to-ovn-secondary-nw-cli.adoc[leveloffset=+2]
6059

6160
ifndef::openshift-rosa,openshift-dedicated[]
6261
[role="_additional-resources"]
63-
[id="additional-resources_virt-connecting-vm-to-ovn-secondary-network"]
62+
[id="additional-resources_{context}"]
6463
== Additional resources
6564
* xref:../../networking/multiple_networks/configuring-additional-network.adoc#configuration-ovnk-additional-networks_configuring-additional-network[Configuration for an OVN-Kubernetes additional network]
6665
* xref:../../networking/k8s_nmstate/k8s-nmstate-about-the-k8s-nmstate-operator.adoc#k8s-nmstate-about-the-k8s-nmstate-operator[About the Kubernetes NMState Operator]

0 commit comments

Comments
 (0)