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 ipam Container Network Interface (CNI) plug-in provides IP address management (IPAM) for other CNI plug-ins.

    You can use the following methods for IP address assignment:

    • 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 plug-in.

    Static IP address assignment configuration

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

    Static assignment configuration

    1. {
    2. "ipam": {
    3. "type": "static",
    4. "addresses": [ (1)
    5. {
    6. "address": "<address>", (2)
    7. "gateway": "<gateway>" (3)
    8. }
    9. ],
    10. "routes": [ (4)
    11. {
    12. "dst": "<dst>", (5)
    13. "gw": "<gw>" (6)
    14. }
    15. ],
    16. "dns": { (7)
    17. "nameservers": ["<nameserver>"], (8)
    18. "domain": "<domain>", (9)
    19. "search": ["<search_domain>"] (10)
    20. }
    21. }

    Dynamic IP address assignment configuration

    DHCP assignment configuration

    Dynamic IP address assignment configuration with Whereabouts

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

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

    Whereabouts assignment configuration

    1. {
    2. "ipam": {
    3. "type": "whereabouts",
    4. "range": "<range>", (1)
    5. "exclude": ["<exclude_part>, ..."], (2)
    6. }
    7. }

    Static IP address assignment configuration example

    You can configure ipam for static IP address assignment:

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

    Dynamic IP address assignment configuration example using DHCP

    You can configure ipam for DHCP:

    Dynamic IP address assignment configuration example using Whereabouts

    You can configure ipam to use Whereabouts:

    1. {
    2. "ipam": {
    3. "range": "192.0.2.192/27",
    4. "exclude": [
    5. "192.0.2.192/30",
    6. "192.0.2.196/32"
    7. ]
    8. }
    9. }

    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. namespace: openshift-sriov-network-operator
      6. spec:
      7. resourceName: net1
      8. networkNamespace: project2
      9. ipam: |-
      10. {
      11. "type": "host-local",
      12. "subnet": "10.56.217.0/24",
      13. "rangeStart": "10.56.217.171",
      14. "rangeEnd": "10.56.217.181",
      15. "gateway": "10.56.217.1"
      16. }
    2. To create the object, enter the following command:

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

    3. Optional: To confirm that the NetworkAttachmentDefinition object that is associated with the SriovIBNetwork object that you created in the previous step exists, enter the following command. Replace <namespace> with the networkNamespace you specified in the SriovIBNetwork object.

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