> For the complete documentation index, see [llms.txt](https://docs.cennso.com/components/fpp/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/fpp/latest/technical-reference/crds/CGWDeployment.md).

# CGWDeployment definition

The `CGWDeployment` Custom Resource (CR) is applied on the Management Cluster and deploys CGW (Connectivity Gateway) instances in the Core Cluster. A CGW is a deployment of a single FPP instance that serves as a network gateway for other FPP and CGW instances.

## Configuration examples

This configuration example shows the `CGWDeployment` CR that you can use to deploy VPP-based webserver:

```yaml
apiVersion: fpp.cennso.com/v1alpha1
kind: CGWDeployment
metadata:
  namespace: default
  name: vpp-webserver
spec:
  connectionSecretRef:
    name: cluster-name
    namespace: cennso-infra
  pullSecretRef:
    name: cennso-pull-secret
  compositionRef:
    name: cgw-generic

  releaseName: vpp-webserver
  targetNamespace: fpp

  repository: oci://registry.cennso.com/cennso/charts
  version: <version>

  operatorName: node-op

  cnfName: vpp-webserver
  logLevel: trace
  labels:
    app: webserver
  imagePullSecrets:
  - name: cennso-pull-secret

  heapSize: 300Mi
  buffersPerNuma: 8192
  resources:
    cpu: "2"
    memory: 350Mi
    hugepages-2Mi: 100Mi

  vpp:
    multicore: false
    dpdk:
      enabled: false

  additionalVolumes:
  - name: srv
    emptyDir: {}

  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

  additionalVolumeMounts:
  - name: srv
    mountPath: /srv

  vppInterfaces:
  - ifName: srv
    attachToNetwork: grx40
    memif:
      role: slave
    ips:
    - 10.0.0.1/24
    mtu: 8930

  vppConfig:
    spec:
      interfaces:
      - srv
      afterCommands:
      - http static server www-root /srv uri tcp://{{ .Ifs.srv.IP }}/80 cache-size 2m fifo-size 60000 debug 2
```

## IPsec and UPF load balancing

> [!IMPORTANT]
> IPsec support and User Plane Function (UPF) load balancing are alpha features and are not suitable for production deployments.

FPP 3.2.0 adds two parameter groups:

- **spec.ipsec.metricsEnabled** - Exposes the metrics of the `ipsec-exporter` `VPPTool` on port `9536` of the CGW Service. List the `ipsec-exporter` `VPPTool` in **spec.vppTools**. See [Set up IPsec](https://docs.cennso.com/components/fpp/latest/deployment-guides/ipsec.md).
- **spec.upflbConfig.spec** - Configures the UPF load balancer (UPF-LB). A non-empty spec enables UPF-LB in the CGW and creates a [`UPFLBConfig`](https://docs.cennso.com/components/fpp/latest/technical-reference/crds/UPFLBConfig.md) CR in the Core Cluster. The **nats.url** and **nats.bucket** parameters are required. See [Set up UPF load balancing](https://docs.cennso.com/components/fpp/latest/deployment-guides/upflb.md).

This example enables IPsec metrics:

```yaml
apiVersion: fpp.cennso.com/v1alpha1
kind: CGWDeployment
metadata:
  namespace: default
  name: cgw-a
spec:
  version: {VERSION}
  connectionSecretRef:
    name: cluster-name
    namespace: cennso-infra
  ...
  vppTools:
  - name: charon
  - name: ipsec-exporter

  ipsec:
    metricsEnabled: true
```

The following example configures UPF load balancing:

```yaml
apiVersion: fpp.cennso.com/v1alpha1
kind: CGWDeployment
metadata:
  namespace: default
  name: cgw-a
spec:
  version: {VERSION}
  connectionSecretRef:
    name: cluster-name
    namespace: cennso-infra
  ...
  upflbConfig:
    spec:
      nats:
        url: nats://nats.nats-system:4222
        bucket: upflb
      nwis:
      - name: epc
        interface: access
        externalTableID: 10
        internalTableID: 20
        ownIP: 198.51.100.20
      - name: sgi
        interface: sgi
        externalTableID: 30
        internalTableID: 40
      uePools:
      - nwiName: sgi
        cidr: 203.0.113.0/25
      interfaces:
      - access
      - access-internal
      - sgi
      - sgi-internal
```

## Configuration parameters

These are all parameters that you can use to configure the `CGWDeployment` CR:

**CRD specification:** [xcgwdeployment_definition.yaml](https://docs.cennso.com/api/spec/components/fpp/latest/assets/xrds/cennso-fpp/xcgwdeployment_definition.yaml?form=bundled&kind=crd)
