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

# UPGDeployment

The `UPGDeployment` Custom Resource (CR) is applied to the Management Cluster to deploy UPG instances in the selected Core Cluster.

The `UPGDeployment` CR is based on a [Crossplane claim](https://docs.crossplane.io/v1.20/concepts/claims/) for the `XUPGDeployment` [composite resource](https://docs.crossplane.io/v1.20/concepts/composite-resources/). You can then use this composite resource in higher-level compositions. 

See the [prerequisites](https://docs.cennso.com/components/upg/latest/deployment-guides/prerequisites.md) for deploying UPG in the Core Cluster.

To deploy UPG in the Core Cluster, you must specify at least these parameters:
- **spec.labels.apn** - defines the Access Point Name (APN).
- **spec.connectionSecretRef** - references the name and namespace of the Secret that contains connection details for the Core Cluster where UPG will be deployed.
- **spec.operatorRef** or **spec.operatorName** - specifies the VPP Operator deployed in the Core Cluster:
   - **spec.operatorRef** references a `VPPOperator` resource on the Management Cluster to resolve the operator name for the VPP Operator deployed in the Core Cluster.
   - **spec.operatorName** directly specifies the name of the VPP Operator. This name must match the **spec.releaseName** of the target [VPPOperator](https://docs.cennso.com/components/fpp/main/concepts/VPPOperator.md).
   - To use the same operator for UPG and FPP, set **spec.operatorName** to the FPP operator's name.
   - To deploy a separate operator for UPG, set a unique **spec.operatorName** and configure **spec.nodeOperatorName** with the FPP operator's name. This configuration allows you to update UPG independently of the VPP operator.
- **spec.instances** - defines the UPG instances. You must define at least one instance.

The **spec.targetNamespace** parameter allows you to customise the namespace of the UPG deployment in the target Core Cluster. By default, the namespace is `basic-pgw`.

For more details on how to use `UPGDeployment` in different scenarios, refer to the following deployment guides:
- [Packet Gateway](https://docs.cennso.com/components/upg/latest/deployment-guides/pgw.md) (PGW)
- [Traffic Detection Function (TDF)](https://docs.cennso.com/components/upg/latest/deployment-guides/tdf.md)

## Installation type

UPG can be deployed as a [Packet Gateway (PGW)](https://docs.cennso.com/components/upg/latest/use-cases/pgw.md) or a [Traffic Detection Function (TDF)](https://docs.cennso.com/components/upg/latest/use-cases/tdf.md). The installation type is specified in the **spec.type** field. If not specified, it defaults to `pgw`.

The **spec.type** parameter determines which Network Instances (NWIs) are created. For more information, see [Configure NWIs](https://docs.cennso.com/components/upg/latest/operation-guides/nwi.md).

## Network configuration

`UPGDeployment` requires network configuration for each of its instances. You must configure:

- Access network (**spec.instances.{NAME}.networking.grx**) used for GTP communication.
- Control network (**spec.instances.{NAME}.networking.sx**) used for PFCP communication with SMF.
- Data networks depending on whether CG-NAT is enabled:
    - When CG-NAT is enabled (`spec.nat.enabled: true` and `spec.nat.type: cgnat`), the **spec.instances.{NAME}.networking.sgi** section must not be configured. Data plane interfaces are instead defined in **spec.instances.{NAME}.nat.pools**.
    - When CG-NAT is not enabled (`spec.nat.enabled: false` or `spec.nat.type: basic`), the **spec.instances.{NAME}.networking.sgi** section is required.

You can configure these networks in two ways:

- Using a reference to a [NetworkAttachment resource](https://docs.cennso.com/cennso/cennso/main/concepts/network-attachment.md) in the **networkAttachmentRef** of the corresponding network configuration. If you use this option and do not specify **networkAttachmentRef.namespace**, the namespace of the `UPGDeployment` is used.
- Using a direct network name in **networkName** in the corresponding network configuration. In this case, it must refer to the [FPPNetwork resource](https://docs.cennso.com/cennso/fpp/main/concepts/fppnetwork.md) present in the target Core Cluster.

When **networkAttachmentRef** is used and the MTU is not explicitly specified in the `UPGDeployment` configuration, it is inherited from the referenced `NetworkAttachment` resource.

Based on this network configuration, UPG [creates interfaces](https://docs.cennso.com/components/upg/latest/operation-guides/interface.md#create-interfaces-using-upgdeployment-cr) and [configures routing tables](https://docs.cennso.com/components/upg/latest/operation-guides/routing-table.md).

> [!NOTE]
> For configuration examples, see the [Technical Reference](https://docs.cennso.com/components/upg/latest/technical-reference/crds/UPGDeployment.md#configuration-examples).

## CG-NAT

UPG supports carrier-grade NAT for large-scale network address translation. The **spec.nat** section controls NAT type, port ranges, flow limits, and timeouts. Per-instance NAT pools with IP ranges and block sizes are configured in **spec.instances.{NAME}.nat.pools**. For more information, see [Enable CG-NAT](https://docs.cennso.com/components/upg/latest/operation-guides/cg-nat.md).

## IPFIX

UPG can export per-flow data to an IPFIX collector. The **spec.ipfixExporters** section defines collector addresses, ports, and template intervals. Per-NWI IPFIX policies and observation domain settings are configured in the **spec.instances.{NAME}.networking.sgi** section. For more information, see [Export IPFIX data](https://docs.cennso.com/components/upg/latest/operation-guides/ipfix.md).

## UE IP export

UPG can export user equipment IP addresses to the Linux kernel routing table for use by external software such as the BGP daemon. The **spec.bgp.enabled** parameter enables UE IP export, and **spec.bgp.table** specifies the routing table ID. For more information, see [UE IP export](https://docs.cennso.com/components/upg/latest/concepts/upgconfig.md#ue-ip-export).

## BGP

UPG uses a BIRD2 BGP daemon as a sidecar to exchange routes with neighbouring gateways. The BGP daemon inserts routes learnt from BGP peering into the VPP routing table, and can announce [exported UE IPs](#ue-ip-export) to edge gateways. The **spec.bgp** section controls BGP daemon deployment, including the routing table ID, network namespace, the interface the BGP daemon is attached to, and the interface the exported UE IP routes point to. Per-instance BIRD2 configuration is set in **spec.instances.{NAME}.bgp.config**. For more information, see [Enable BGP support](https://docs.cennso.com/components/upg/latest/deployment-guides/bgp.md).

## Policy-based routing

Policy-based routing enables traffic steering to different data networks. The **spec.routingTableSelectors** parameter selects RoutingTable CRs to apply to UPG instances. Required routing tables are declared in **spec.instances.{NAME}.requiredRoutingTables**, and policy rules are configured through **spec.instances.{NAME}.additionalConfig**. For more information, see [Configure policy-based routing](https://docs.cennso.com/components/upg/latest/operation-guides/policy-based-routing.md).

## NWIs

In addition to Network Instances (NWIs) generated from the [network configuration](#network-configuration), the **spec.nwis** section allows configuring custom NWI names and types. UE IP pools are assigned to NWIs using **spec.instances.{NAME}.uepools**. For more information, see [Configure NWIs](https://docs.cennso.com/components/upg/latest/operation-guides/nwi.md).

### NWI strict routing

Strict routing creates separate Rx and Tx routing tables per NWI to prevent improper UE-to-UE traffic forwarding. It is enabled per interface using **spec.instances.{NAME}.networking.{NETWORK}.ipv4.strictRouting** or **ipv6.strictRouting**. For more information, see [Enable NWI strict routing table separation](https://docs.cennso.com/components/upg/latest/operation-guides/nwi-strict-routing.md).

## PFCP server

PFCP server parameters configure control plane connectivity. The **spec.pfcpHeartbeatTimeout** and **spec.pfcpHeartbeatRetries** parameters configure heartbeat reliability. The **spec.pfcpFIFOSize** sets the message buffer size, and **spec.rateLimiterPPS** limits the rate of PFCP Session Report Request messages. For more information, see [Configure PFCP server](https://docs.cennso.com/components/upg/latest/operation-guides/pfcp-server.md).

## NFR registration

The **spec.registration** parameter controls NFR (Network Function Repository) registration. NFR allows 5G network functions to register themselves and discover other network functions. NFR registration is required when deploying UPG with [SMC](https://docs.cennso.com/components/smc/main.md).

>**NOTE:** NFR registration is not supported in [Carrier-Grade NAT (CG-NAT)](https://docs.cennso.com/components/upg/latest/operation-guides/cg-nat.md) mode.
