> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/3.2/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/3.2/concepts/vppdeployment.md).

# VPPDeployment CR

`VPPDeployment` Custom Resource (CR) is applied on the Core Cluster and is used to manage the lifecycle of VPPs running on the cluster.

```yaml
---
apiVersion: fpp-manager.cennso.com/v1alpha1
kind: VPPDeployment
metadata:
  labels:
    fpp-manager.cennso.com/created-for: node-op
  name: cgw1
  namespace: cgw-advanced
spec:
  # The 'instance' mode specifies a single VPP pod managed via a StatefulSet,
  # commonly used for CGWs (Connectivity Gateway).
  # The 'node' mode is used for VPPSwitch pods that are managed via DaemonSets
  type: instance

  # Setting 'disable: true' will cause all of the resources generated from this
  # VPPDeployment to be removed
  disable: false

  # vppOptions section contains "lower-level" VPP specific options
  vppOptions:
    # CNI binary directory for FPP-CNI plugin deployment.
    # Only used in the node mode, defaults to /opt/cni/bin
    # cniBinDir: /opt/cni/bin

    # enable CNI debug log in /tmp/cni.log
    # (not recommended for production!)
    # Only used in the node mode, defaults to false
    # cniDebug: true

    # Log level, one of debug, trace, info, error.
    # Defaults to debug
    logLevel: debug

    # multusNetworks specifies the names of Multus CNI NADs
    # (Network Attachment Definitions) to be used by the FPP pod
    multusNetworks:
    - cgw1-ext
    - cgw1-int

    # Run VPP under GDB, providing more informative stack traces
    # in case of a crash. Defaults to false
    gdbEnabled: true

    # GDB commands to execute. Only used with gdbEnabled: true.
    # By default is empty
    gdbScript: "..."


    # Defines a name for the NetCap Plugin to distinguish the traffic streams at the NetCap Sink.
    # The default value is set to the Kubernetes worker node name or Statefulset instance name.
    # netcapName: someName

    # Defines the non-default path to NetCap Collector, used for traffic capturing.
    # The default value is /run/vppswitch/sink.sock
    # netcapSocketPath: /run/netcap/sink.sock

    # Defines a set of arbitrary labels attached to a NetCap stream.
    # netcapLabels:
    #   apn: test.cennso.com
    #   lane: lane-b

    # Specifies that VPP uses just one core.
    # Useful for testing purposes, defaults to false
    singleCore: true

    # disableDPDK disables the use of VPP DPDK driver.
    # Defaults to false
    disableDPDK: true

    # Stops VPP process in case it hangs. Defaults to false
    # Not yet implemented in FPP 2.0
    stopOnHang: true

    # Enables verbose tracing of VPP API calls.
    # Defaults to false. Not yet implemented in FPP 2.0
    traceAPICalls: true

    # Allows HyperThreading sibling cores to be used for VPP. For testing purposes only!
    # Defaults to false
    allowHtSiblings: true

    # Buffers to allocate per NUMA node. Defaults to 256000.
    # Smaller values can be used for test environments
    buffersPerNuma: 8192

    # NIC resources to allocate for the VPP pods for the use as
    # uplinks and external network interfaces (as configured in the VPPConfig)
    nicResources:
    - interfacePrefix: uplink0 # prefix of the DPDK interface names
      numRxQueues: 4 # number of RX queues
      numTxQueues: 4 # number of TX queues
      numRxDesc: 4 # number of RX descriptors
      numTxDesc: 4 # number of TX descriptors
      # resource name (corresponds to one provided by the SRIOV Network Operator SriovNetworkNodePolicy.spec.resourceName)
      resourceName: openshift.io/wl0_vfio
      count: 1 # number of resources to use

    # Use some physical NICs directly without SRIOV Network Operator
    directNICMappings:
    - interfacePrefix: nic # prefix of the DPDK interface name
      numRxQueues: 4 # number of RX queues
      numTxQueues: 4 # number of TX queues
      numRxDesc: 4 # number of RX descriptors
      numTxDesc: 4 # number of TX descriptors
      pciIDs:
      - "0000:8a:00.1"
      - "0000:8a:00e.3"

    # Static CPU cores to use instead of Kubernetes-allocated ones.
    # Not used by default. There should be no CPU limits for the FPP pod
    # if this is specified.
    # staticCPUCores: "27,28,29,30,31"

    # Max number of CPU cores to be used, including the main core.
    # The remaining cores can be used by vhost kernel threads serving
    # TAP interfaces created by VPP. Defaults to 0, which disables the
    # mechanism, allocating all the cores available to the pod to VPP.
    maxCPUCores: 3

    # VPP heap size. Defaults to 6Gi. The VPPDeployment needs to have
    # enough resources specified to accommodate for the heap, buffers and
    # the statseg.
    heapSize: 300Mi

    # VPP stat segment size. Defaults to 512Mi.
    statSegSize: 512Mi

    # Enable coredump for the VPP process. Defaults to false
    enableCoredump: true

    # VPP buffer size in bytes
    # 3776 for memifs
    # 3648 for DPDK (real NICs)
    defaultDataSize: 3648

    # Use hugepages for VPP stats segment, buffers and heap.
    # Defaults to false
    useHugepages: false

    # Set VPP poll sleep, useful for local and CI deployments.
    # It reduces the CPU consumption.
    # pollSleepUs: 1000

  # podOptions specifies the options controlling the FPP pod specs
  podOptions:
    # additional pod labels to apply to the FPP pod
    podLabels:
      foo: bar

    # additional pod annotations to apply to the FPP pod
    podAnnotations:
      foo: bar

    # imagePullSecrets to use for the pod
    imagePullSecrets:
    - name: mysecret

    # Termination grace period in seconds, defaults to 30
    terminationGracePeriodSeconds: 10

    # Use host PID namespace. Defaults to true for node pods, otherwise defaults to false.
    hostPID: true

    # Pod affinity specification
    affinity:
      podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
        - weight: 99
          podAffinityTerm:
            labelSelector:
              matchExpressions:
              - key: fpp-manager.cennso.com/plumbing-instance
                operator: In
                values:
                - cgw2
            topologyKey: "kubernetes.io/hostname"

    # Pod tolerations
    tolerations:
    - effect: NoSchedule
      key: example-key
      operator: Exists

    # additional init container specs to add to the FPP pods
    additionalInitContainers:
    - name: init
      image: busybox
      command:
      - /bin/sh
      - -c
      - for i in `seq 10`; do echo hello world; done >/srv/hello.txt
      volumeMounts:
      - name: srv
        mountPath: /srv

    # additional containers to add to the FPP pod
    additionalContainers:
    - name: init
      image: busybox
      command: ["/usr/local/bin/myscript.sh"]

    # the name of Service Account to use
    serviceAccountName: my-sa

    # node selector for the pod
    nodeSelector:
      kubernetes.io/hostname: fpp-cluster-control-plane

    # extra volumes to add to the FPP pod
    additionalVolumes:
    - name: srv
      emptyDir: {}

  # VPP container options
  containerOptions:
    # Image to use
    image: registry.cennso.com/cennso-dev/vpp-worker:debug

    # Image pull policy
    imagePullPolicy: Always

    # Resource specifications
    resources:
      cpu: "2"
      hugepages-2Mi: 100Mi
      memory: 350Mi

    # Readiness probe options
    readinessProbeOptions:
      initialDelaySeconds: 3
      timeoutSeconds: 5
      periodSeconds: 3
      successThreshold: 2
      failureThreshold: 2

    # Liveness probe options
    livenessProbeOptions:
      initialDelaySeconds: 3
      timeoutSeconds: 5
      periodSeconds: 3
      successThreshold: 2
      failureThreshold: 2

    # Additional volume mounts for the VPP container
    additionalVolumeMounts:
    - name: srv
      mountPath: /srv

    # Command override for the VPP container.
    # Can be used for debugging purposes. It is recommended to
    # disable the probes if the default startup script is not used
    # command: ["/bin/bash", "-c", "sleep Infinity"]

    # Disables probes (for debugging purposes). Defaults to false
    disableProbes: true

  # daemonSet options are only used for node-mode FPP pods
  daemonSetOptions:
    updateStrategy:
      type: OnDelete
    minReadySeconds: 3

  # objectSelectors can be used to customize the label matching
  # criteria for the RoutingTables
  objectSelectors:
    routingTableSelectors:
    - matchLabels:
        foo: bar

  # References to VPPTool CRs that should be used as templates
  # for additional containers in the FPP pod
  tools:
  - name: bird
  - name: bird-exporter
```

To disable VPPDeployment from CLI, run:

```bash
kubectl patch vppdeployment -n cgw-advanced cgw1 -p '{"spec":{"disable": true}}' --type=merge
```

To enable it back, run:

```bash
kubectl patch vppdeployment -n cgw-advanced cgw1 -p '{"spec":{"disable": false}}' --type=merge
```
