> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/2.11/llms.txt) (all documentation: [llms.txt](https://docs.cennso.com/llms.txt)). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cennso.com/components/fpp/2.11/installation/multinode-sriov.md).

# Deploy Fast Path Provider on multiple nodes using SRIOV networks as FPP uplinks

This document describes the prerequisites and steps for a multi-node deployment of Fast Path Provider (FPP) using SRIOV networks as FPP uplinks. There is also a tutorial for [a direct NIC assignment for the uplinks](https://docs.cennso.com/components/fpp/2.11/installation/multinode-direct-nic.md).

## Prerequisites

- [Common prerequisites](https://docs.cennso.com/components/fpp/2.11/installation/installation-common.md)
- [SR-IOV Network Operator](https://github.com/k8snetworkplumbingwg/sriov-network-operator) installed in the Kubernetes cluster
- [Multus CNI](https://github.com/k8snetworkplumbingwg/multus-cni) installed in the Kubernetes cluster
- [Whereabouts CNI IPAM plugin](https://github.com/k8snetworkplumbingwg/whereabouts) to handle uplink IP address assignment, if SRIOV Virtual Functions as uplink are used in VPPSwitch

Terminology used in the installation document:

- VPPSwitch - Amberd pod in the `node` mode, which acts as a virtual switch on each Data Plane node
- Uplink - network interface, virtual or physical, which is used by VPPSwitch to communicate inside the cluster and create a VXLAN mesh to interconnect workload CNFs between nodes

### Supported NICs

The following Network Interface Cards are supported using this installation guide:

- **Intel X710**, vendor ID: **8086**, device ID: **1572**, model: Ethernet Controller X710 for 10GbE SFP+
- **Intel XL710**, vendor ID: **8086**, device ID: **1583**, model: Ethernet Controller XL710 for 40GbE QSFP+
- **Intel X710**, vendor ID: **8086**, device ID: **1589**, model: Ethernet Controller X710/X557-AT 10GBASE-T
- **Intel XXV710**, vendor ID: **8086**, device ID: **158b**, model: Ethernet Controller XXV710 for 25GbE SFP28

### Uplinks using SRIOV VFs

FPP requires the SR-IOV Network Operator to have `PCIDEVICE_` as environment variables with a PCI device ID, for example:

```sh
declare -x PCIDEVICE_OPENSHIFT_IO_UPLINK0="0000:06:0a.4"
declare -x PCIDEVICE_OPENSHIFT_IO_UPLINK1="0000:06:02.6"
```

The above variable is set by SRIOV Network Device Plugin, which can be installed independently or by SRIOV Operator.

FPP was tested with the following versions of SRIOV Operator:

- [origin-sriov-operator](https://quay.io/repository/openshift/origin-sriov-network-operator?tab=tags) `4.3.0`
- [openshift/sriov-network operator](https://github.com/openshift/sriov-network-operator) commit `104db73503782b16900ebc1ce14f809bde2f1086`, based on release 4.9

## Steps

1. Configure the SRIOV Operator

   You need then to configure `SriovNetworkNodePolicy` objects for uplinks, that is the NICs used by VPPSwitch daemon pods. If you want to use the standard deployment YAMLs without changing resource specifications, you need to name the uplink resources `uplink0`, `uplink1` and so on, which together with `RESOURCE_NAME` of `openshift.io` specified for SR-IOV Network Operator results in Kubernetes resource names like `openshift.io/uplink0`, `openshift.io/uplink1` and so on.

   The following is an example of `SriovNetworkNodePolicy` for Intel XL710 VFs:

   ```yaml
   ---
   apiVersion: sriovnetwork.openshift.io/v1
   kind: SriovNetworkNodePolicy
   metadata:
      name: sriov-network-node-policy-uplink0
      namespace: sriov-network-operator
   spec:
      deviceType: vfio-pci
      mtu: 9000
      nicSelector:
         deviceID: "1583"
         pfNames:
         - eth0
         rootDevices:
         - "0000:04:00.3"
         vendor: "8086"
      nodeSelector:
         feature.node.kubernetes.io/network-sriov.capable: "true"
      numVfs: 4
      priority: 99
      resourceName: uplink0
   ```

   The above example creates 4 VFs on eth0 NIC on nodes that match `nodeSelector`. If the hardware is different across different nodes of the cluster (different NICs or their PCI configurations), there should be multiple `SriovNetworkNodePolicy` objects created with different `nodeSelector` values. This also requires creating multiple fpp-manager deployments with different networks attached to it through NetworkAttachmentDefinitions.

   If multiple uplinks are used, FPPManager creates a bond that is comprised of these uplinks.

   You also need to create `SriovNetwork` objects for the uplinks. For uplinks that are used without bonding, you need to specify IP address in the `ipam` section.  In the case of bonded interfaces, the first interface among bonded must have an IP address. You can use [Whereabouts CNI IPAM plugin](https://github.com/k8snetworkplumbingwg/whereabouts) to facilitate this task. A `SriovNetwork` with an assigned IP address may look like this:

   ```yaml
   apiVersion: sriovnetwork.openshift.io/v1
   kind: SriovNetwork
   metadata:
      name: sriov-network-uplink0
      namespace: sriov-network-operator
   spec:
      ipam: |-
         {
            "range": "10.30.38.0/24",
            "type": "whereabouts"
         }
      resourceName: uplink0
      spoofChk: "off"
      trust: "on"
   ```

   >**TIP**: If you encounter any issues during configuration, refer to the [SRIOV troubleshooting guide](https://docs.cennso.com/components/fpp/2.11/troubleshooting/sriov.md).

1. Enable image download

   In order to be able to pull FPP images from a private registry, you may need to configure imagePullSecrets for the FPP service account. One possibility is to create `/tmp/pullsecret.yaml` file, adding proper base64-encoded docker auth information, so that later it can be used to augment the FPP deployment:

   ```yaml
   ---
   apiVersion: v1
   kind: Secret
   type: kubernetes.io/dockerconfigjson
   metadata:
      name: image-secret
   data:
      .dockerconfigjson: ...
   ---
   apiVersion: v1
   kind: ServiceAccount
   metadata:
      name: fpp-sa
   imagePullSecrets:
   - name: image-secret
   ```

   Create this secret in `{FPP_NAMESPACE}`:

   ```bash
   kubectl apply -n {FPP_NAMESPACE} -f /tmp/pullsecret.yaml
   ```

1. Label the nodes

   For the FPP DaemonSet to actually start, each node in the cluster using FPP must get a label, for example `fpp-manager.cennso.com/vppswitch-uplinks=2`:

   ```bash
   kubectl label node node1 node2 node3 fpp-manager.cennso.com/vppswitch-uplinks=2
   kubectl label node node1 node2 node3 fpp-manager.cennso.com/vppswitch=""
   ```

   `fpp-manager.cennso.com/vppswitch=""` is used for workloads' nodeSelector to select the nodes where VPPSwitch is available.

1. Install the [FPP chart](https://docs.cennso.com/components/fpp/2.11/installation/chart-configuration.generated.md) in the [`node` mode](https://docs.cennso.com/components/fpp/2.11/installation/deployment-types.md) using the following chart configuration:

   - Configure the number of buffers per NUMA for optimal performance

      ```yaml
      buffersPerNuma: 512000
      ```

   - Configure image pull secret to be able to download the `fpp-manager` image from a private registry

      ```yaml
      imagePullSecrets:
      - name: image-secret
      ```

      Instead of using image pull secret, you can use a preconfigured service account:

      ```yaml
      serviceAccount: fpp-sa
      ```

   - Specify an optional log level:

      ```yaml
      # available values: trace, debug, info, error
      logLevel: "debug"
      ```

      To enable more verbose logging, VPP API calls (on the internal intermediate VPPLink level) and Kubernetes controller events (Create/Update/Delete) can be logged:

      ```yaml
      vpp:
        traceAPICalls: true
        logLevel: "trace"
      ```

   - Specify the node selector for the subset of nodes to deploy FPP DaemonSet:

      ```yaml
      nodeSelector:
        fpp-manager.cennso.com/vppswitch-uplinks: "2"
      ```

   - Configure pod resources:

      ```yaml
      resources:
        cpu: "10"
        hugepages-2Mi: 9Gi
        memory: 2Gi
      ```

   - Configure uplink and external network interfaces:

      ```yaml
      uplinkResources:
        openshift.io/uplink0: sriov-network-node-policy-uplink0
        # openshift.io/uplink0 - this is the Kubernetes resource name, based on SriovNetworkNodePolicy.spec.resourceName
        # sriov-network-node-policy-uplink0 - this is SriovNetwork or Network Attachment Definition name, based on SriovNetwork.metadata.name
        openshift.io/uplink1:
          network: sriov-network-node-policy-uplink1
          numRxQueues: 12
          numTxQueues: 12
          numRxDesc: 2048
          numTxDesc: 2048
      ```

      To configure external network interfaces using VFs, use the following chart configuration:

      ```yaml
      externalNetworks:
        ext-net:  # this name is used as interface name prefix in startup.conf
          openshift.io/extnet: extnet0
          # openshift.io/extnet - this is the Kubernetes resource name, based on SriovNetworkNodePolicy.spec.resourceName
          # extnet0 - this is SriovNetwork or Network Attachment Definition name, based on SriovNetwork.metadata.name
        anotherExtNet:
          dummy.io/external-2:
            network: external-2-nad
            numRxQueues: 10
            numTxQueues: 8
            numRxDesc: 1024
            numTxDesc: 512
      ```

      In order to configure an external network interface, VPPConfig can be used, for example:

      ```yaml
      vppConfigs:
      - nodeName: wk-node1.eu.cennso.net
      spec:
         externalNetworkConfig:
         - bridgeDomain: 20
            ifacePrefix: ext-net
            ips:
            - 10.100.0.123/24
            mtu: 8930
      ```

      `vppConfigs[].spec.externalNetworkConfig.ifacePrefix` must match `externalNetworks` key name (`ext-net` or `anotherExtNet` from above example).

      To define a **VPPConfig** that applies to all FPP pods in the `node` mode:

      ```yaml
      vppConfigs:
      - nodeName: ""
         spec:
            uplinkConfig:
            bondMode: ActiveBackup
            prefixLen4: 24
            prefixLen6: 64
      ```
