Configuring an SR-IOV InfiniBand network attachment

    You can configure an InfiniBand (IB) network device by defining an object.

    The following YAML describes an SriovIBNetwork object:

    The IP address management (IPAM) Container Network Interface (CNI) plugin provides IP addresses for other CNI plugins.

    You can use the following IP address assignment types:

    • Static assignment.

    • Dynamic assignment through a DHCP server. The DHCP server you specify must be reachable from the additional network.

    • Dynamic assignment through the Whereabouts IPAM CNI plugin.

    Static IP address assignment configuration

    The following table describes the configuration for static IP address assignment:

    Table 1. ipam static configuration object
    FieldTypeDescription

    type

    string

    The IPAM address type. The value static is required.

    addresses

    array

    An array of objects specifying IP addresses to assign to the virtual interface. Both IPv4 and IPv6 IP addresses are supported.

    routes

    array

    An array of objects specifying routes to configure inside the pod.

    dns

    array

    Optional: An array of objects specifying the DNS configuration.

    The addresses array requires objects with the following fields:

    Table 2. ipam.addresses[] array
    FieldTypeDescription

    address

    string

    gateway

    string

    The default gateway to route egress network traffic to.

    Table 4. ipam.dns object
    FieldTypeDescription

    nameservers

    array

    An array of one or more IP addresses for to send DNS queries to.

    domain

    array

    The default domain to append to a hostname. For example, if the domain is set to example.com, a DNS lookup query for example-host is rewritten as example-host.example.com.

    search

    array

    An array of domain names to append to an unqualified hostname, such as example-host, during a DNS lookup query.

    Static IP address assignment configuration example

    1. {
    2. "ipam": {
    3. "type": "static",
    4. "addresses": [
    5. {
    6. }
    7. ]
    8. }
    9. }

    Dynamic IP address (DHCP) assignment configuration

    The following JSON describes the configuration for dynamic IP address address assignment with DHCP.

    Renewal of DHCP leases

    A pod obtains its original DHCP lease when it is created. The lease must be periodically renewed by a minimal DHCP server deployment running on the cluster.

    To trigger the deployment of the DHCP server, you must create a shim network attachment by editing the Cluster Network Operator configuration, as in the following example:

    Example shim network attachment definition

    Dynamic IP address (DHCP) assignment configuration example

    1. {
    2. "ipam": {
    3. "type": "dhcp"
    4. }
    5. }

    Dynamic IP address assignment configuration with Whereabouts

    The Whereabouts CNI plugin allows the dynamic assignment of an IP address to an additional network without the use of a DHCP server.

    The following table describes the configuration for dynamic IP address assignment with Whereabouts:

    Table 6. ipam whereabouts configuration object
    FieldTypeDescription

    type

    string

    The IPAM address type. The value is required.

    range

    string

    An IP address and range in CIDR notation. IP addresses are assigned from within this range of addresses.

    exclude

    array

    Optional: A list of zero or more IP addresses and ranges in CIDR notation. IP addresses within an excluded address range are not assigned.

    Dynamic IP address assignment configuration example that uses Whereabouts

    You can configure an additional network that uses SR-IOV hardware by creating an SriovIBNetwork object. When you create an SriovIBNetwork object, the SR-IOV Network Operator automatically creates a NetworkAttachmentDefinition object.

    Do not modify or delete an SriovIBNetwork object if it is attached to any pods in a running state.

    Prerequisites

    • Install the OpenShift CLI (oc).

    • Log in as a user with cluster-admin privileges.

    Procedure

    1. Create a SriovIBNetwork object, and then save the YAML in the <name>.yaml file, where <name> is a name for this additional network. The object specification might resemble the following example:

      1. apiVersion: sriovnetwork.openshift.io/v1
      2. kind: SriovIBNetwork
      3. metadata:
      4. name: attach1
      5. spec:
      6. resourceName: net1
      7. networkNamespace: project2
      8. ipam: |-
      9. {
      10. "type": "host-local",
      11. "subnet": "10.56.217.0/24",
      12. "rangeStart": "10.56.217.171",
      13. "rangeEnd": "10.56.217.181",
      14. "gateway": "10.56.217.1"
      15. }
    2. To create the object, enter the following command:

      where <name> specifies the name of the additional network.

      1. $ oc get net-attach-def -n <namespace>