Chapter 3. Creating networks with director Operator
To create networks and bridges on OpenShift Virtualization worker nodes and connect your virtual machines (VMs) to these networks, you define your OpenStackNetConfig
custom resource (CR) and specify all the subnets for the overcloud networks. You must create one control plane network for your overcloud. You can also optionally create additional networks to implement network isolation for your composable networks.
3.1. Creating an overcloud network with the OpenStackNetConfig CRD Copy linkLink copied to clipboard!
You must use the OpenStackNetConfig
CRD to define at least one control plane network for your overcloud. You can also optionally define VLAN networks to create network isolation for composable networks such as InternalAPI
, Storage
, and External
. Each network definition must include the IP address assignment, and the mapping information for the OpenStackNetAttachment
CRD. OpenShift Virtualization uses the network definition to attach any virtual machines (VMs) to the control plane and VLAN networks.
Use the following commands to view the OpenStackNetConfig
CRD definition and specification schema:
oc describe crd openstacknetconfig oc explain openstacknetconfig.spec
$ oc describe crd openstacknetconfig
$ oc explain openstacknetconfig.spec
Procedure
-
Create a file named
openstacknetconfig.yaml
on your workstation. Add the following configuration to
openstacknetconfig.yaml
to create theOpenStackNetConfig
custom resource (CR):apiVersion: osp-director.openstack.org/v1beta1 kind: OpenStackNetConfig metadata: name: openstacknetconfig
apiVersion: osp-director.openstack.org/v1beta1 kind: OpenStackNetConfig metadata: name: openstacknetconfig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Configure network attachment definitions for the bridges you require for your network. For example, add the following configuration to
openstacknetconfig.yaml
to create the RHOSP bridge network attachment definitionbr-osp
, and set thenodeNetworkConfigurationPolicy
option to create a Linux bridge:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: To use Jumbo Frames for a bridge, configure the bridge interface to use Jumbo Frames and update the value of
mtu
for the bridge:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Define each overcloud network. The following example creates a control plane network and an isolated network for
InternalAPI
traffic:Copy to Clipboard Copied! Toggle word wrap Toggle overflow - 1
- The name of the network, for example,
Control
. - 2
- The lowercase version of the network name, for example,
ctlplane
. - 3
- The subnet specifications.
- 4
- The name of the subnet, for example,
ctlplane
. - 5
- Details of the IPv4 subnet with
allocationStart
,allocationEnd
,cidr
,gateway
, and an optional list of routes withdestination
andnexthop
. - 6
- The network attachment definition to connect the network to. In this example, the RHOSP bridge,
br-osp
, is connected to a NIC on each worker. - 7
- The network definition for a composable network. To use the default RHOSP networks, you must create an
OpenStackNetConfig
resource for each network. For information on the default RHOSP networks, see Default Red Hat OpenStack Platform networks. To use different networks, you must create a customnetwork_data.yaml
file. For information on creating a customnetwork_data.yaml
file, see Configuring overcloud networking. - 8
- The network VLAN. For information on the default RHOSP networks, see Default Red Hat OpenStack Platform networks. For more information on virtual machine bridging with the
OpenStackNetConfig
CRD, see Understanding virtual machine bridging with the OpenStackNetConfig CRD.
Optional: Reserve static IP addresses for networks on specific nodes:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteReservations have precedence over any autogenerated IP addresses.
-
Save the
openstacknetconfig.yaml
definition file. Create the overcloud network:
oc create -f openstacknetconfig.yaml -n openstack
$ oc create -f openstacknetconfig.yaml -n openstack
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To verify that the overcloud network is created, view the resources for the overcloud network:
oc get openstacknetconfig/openstacknetconfig
$ oc get openstacknetconfig/openstacknetconfig
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the
OpenStackNetConfig
API and child resources:oc get openstacknetconfig/openstacknetconfig -n openstack oc get openstacknetattachment -n openstack oc get openstacknet -n openstack
$ oc get openstacknetconfig/openstacknetconfig -n openstack $ oc get openstacknetattachment -n openstack $ oc get openstacknet -n openstack
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If you see errors, check the underlying
network-attach-definition
and node network configuration policies:oc get network-attachment-definitions -n openstack oc get nncp
$ oc get network-attachment-definitions -n openstack $ oc get nncp
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.1.1. Default Red Hat OpenStack Platform networks Copy linkLink copied to clipboard!
Network | VLAN | CIDR | Allocation |
---|---|---|---|
External | 10 | 10.0.0.0/24 | 10.0.0.10 - 10.0.0.250 |
InternalApi | 20 | 172.17.0.0/24 | 172.17.0.10 - 172.17.0.250 |
Storage | 30 | 172.18.0.0/24 | 172.18.0.10 - 172.18.0.250 |
StorageMgmt | 40 | 172.19.0.0/24 | 172.19.0.10 - 172.19.250 |
Tenant | 50 | 172.20.0.0/24 | 172.20.0.10 - 172.20.0.250 |
3.2. Understanding virtual machine bridging with the OpenStackNetConfig CRD Copy linkLink copied to clipboard!
When you create virtual machines (VMs) with the OpenStackVMSet
CRD, you must connect these VMs to the relevant Red Hat OpenStack Platform (RHOSP) networks. You can use the OpenStackNetConfig
CRD to create the required bridges on the Red Hat OpenShift Container Platform (RHOCP) worker nodes and connect your Controller VMs to your RHOSP overcloud networks. RHOSP requires dedicated NICs to deploy.
The OpenStackNetConfig
CRD includes an attachConfigurations
option, which is a hash of nodeNetworkConfigurationPolicy
. Each specified attachConfiguration
in an OpenStackNetConfig
custom resource (CR) creates a NetworkAttachmentDefinition
object, which passes network interface data to the NodeNetworkConfigurationPolicy
resource in the RHOCP cluster. The NodeNetworkConfigurationPolicy
resource uses the nmstate
API to configure the end state of the network configuration on each RHOCP worker node. The NetworkAttachmentDefinition
object for each network defines the Multus CNI plugin configuration. When you specify the VLAN ID for the NetworkAttachmentDefinition
object, the Multus CNI plugin enables vlan-filtering
on the bridge. Each network configured in the OpenStackNetConfig
CR references one of the attachConfigurations
. Inside the VMs, there is one interface for each network.
The following example creates a br-osp attachConfiguration
, and configures the nodeNetworkConfigurationPolicy
option to create a Linux bridge and connect the bridge to a NIC on each worker. When you apply this configuration, the NodeNetworkConfigurationPolicy
object configures each RHOCP worker node to match the required end state: each worker contains a new bridge named br-osp
, which is connected to the enp6s0
NIC on each host. All RHOSP Controller VMs can connect to the br-osp
bridge for control plane network traffic.
If you specify an Internal API network through VLAN 20, you can set the attachConfiguration
option to modify the networking configuration on each RHOCP worker node and connect the VLAN to the existing br-osp
bridge:
The br-osp
already exists and is connected to the enp6s0
NIC on each host, so no change occurs to the bridge itself. However, the InternalAPI
OpenStackNet
associates VLAN 20 to this network, which means RHOSP Controller VMs can connect to the VLAN 20 on the br-osp
bridge for Internal API network traffic.
When you create VMs with the OpenStackVMSet
CRD, the VMs use multiple Virtio devices connected to each network. OpenShift Virtualization sorts the network names in alphabetical order except for the default
network, which is the RHOCP cluster network that all the pods are connected to. The default
network is always the first interface. You cannot configure the default
network. For example, if you create the default RHOSP networks with OpenStackNetConfig
, the following interface configuration is generated for Controller VMs:
This configuration results in the following network-to-interface mapping for Controller nodes:
Network | Interface |
---|---|
default | nic1 |
ctlplane | nic2 |
external | nic3 |
internalapi | nic4 |
storage | nic5 |
storagemgmt | nic6 |
tenant | nic7 |
The role NIC template used by OpenStackVMSet
is auto generated. You can overwrite the default configuration in a custom NIC template file, <role>-nic-template.j2
, for example, controller-nic-template.j2
. You must add your custom NIC file to the tarball file that contains your overcloud configuration, which is implemented by using an OpenShift ConfigMap object. For more information, see Chapter 4. Customizing the overcloud with director Operator.
3.3. Example OpenStackNetConfig custom resource file Copy linkLink copied to clipboard!
The following example OpenStackNetConfig
custom resource (CR) file defines an overcloud network which includes a control plane network and isolated VLAN networks for a default RHOSP deployment. The example also reserves static IP addresses for networks on specific nodes.