L4Route

This CR defines how the Layer4 routing should be managed within the Kubernetes cluster, allowing requests to be routed at the transport layer (TCP/UDP). L4Route is created based on the experimental TCPRoute/UDPRoute defined by the Gateway API community.

CR Parameters

The table below describes the L4Route spec parameters:

Parameter Description
protocol Specifies the application protocol accepted by the listener. Valid values are TCP or UDP.
Note: If the implementation does not support the specified protocol, set the Accepted condition to False for the affected listener with a reason of “UnsupportedProtocol”.
parentRefs.name Specifies the name of the referent for the Gateway parent references.
parentRefs.sectionName Specifies the name of a section within the target resource.
rules.backendRefs.name Specifies the name to which the Route should forward the a request to a Kubernetes resource (backend service)
rules.backendRefs.port Specifies the port to which the Route should forward the a request to a Kubernetes resource (backend service)
pvaAccelerationMode Enables the preferred acceleration mode for the Packet Velocity ASIC (PVA). The available values are: full/assisted (default) and disabled
* full/assisted: In this mode, traffic routes through the BF3 DPU, enabling hardware offloading for enhanced performance and efficiency
* disabled: In this mode, traffic routes through TMM, which does not use the DPU’s hardware capabilities
Note: This field is only effective for the BF3 DPU Controller
pvaDynamicClientPkts Specifies the number of client packets before dynamic re-offloading occurs. The default value is 0
pvaDynamicServerPkts Specifies the number of server packets before dynamic re-offloading occurs. The default value is 1
Note: If the implementation does not support the specified protocol, set the Accepted condition to false for the affected listener with a reason of UnsupportedProtocol.

Support Status

The table below describes the support status of L4Route CR paremeters:

Parameter Supported/Not Supported/Optional
protocol Supported
parentRefs.name Supported
parentRefs.sectionName Supported
rules.backendRefs.name Supported
rules.backendRefs.port Supported

Sample CRs

L4Routes TCP usecase CR

apiVersion: gateway.k8s.f5net.com/v1
kind: L4Route
metadata:
  name: l4-app-1
spec:
  protocol: TCP
  parentRefs:
  - name: my-l4-gateway
    sectionName: foo
  rules:
  - backendRefs:
    - name: spk-app-tcp-8000-f5ing-testapp
      port: 8000

L4Routes UDP usecase CR

apiVersion: gateway.k8s.f5net.com/v1
kind: L4Route
metadata:
  name: l4-app-1-udp
spec:
  protocol: UDP
  parentRefs:
  - name: my-l4-gateway
    sectionName: foo
  rules:
  - backendRefs:
    - name: nginx-server-udp
      port: 10001

L4Routes traffic weight distribution CR

apiVersion: gateway.k8s.f5net.com/v1
kind: L4Route
metadata:
  name: l4-app-1
spec:
  protocol: TCP
  parentRefs:
  - name: my-l4-gateway
    sectionName: foo
  rules:
  - backendRefs:
    - name: tcp-testapp-rg-0-f5ing-testapp
      port: 8050  
      weight: 70
    - name: tcp-testapp-rg-1-f5ing-testapp
      port: 8050
      weight: 30

L4Routes VLAN config CR

apiVersion: gateway.networking.k8s.io/v1
kind: GatewayClass
metadata:
  name: my-tcp-gateway-class
spec:
  controllerName: "f5.com/f5-gateway-controller"
  description: "F5 BIG-IP Kubernetes Gateway"
---
apiVersion: gateway.k8s.f5net.com/v1
kind: Gateway
metadata:
  name: my-tcp-gateway
  namespace: spk-app-1
spec:
  addresses:
  - type: "IPAddress"
    value: <IP Address>
  - type: "IPAddress"
    value: <IP Address>
  gatewayClassName: my-tcp-gateway-class
  infrastructure:
    listeningVlans:
      vlanList:
        - "tmm-client"
        - "tmm-server"
      disableListedVlans: false
        #category: "aa"
  listeners:
  - name: foo
    protocol: TCP
    port: 80
    allowedRoutes:
      kinds:
      - kind: L4Route
---
apiVersion: gateway.k8s.f5net.com/v1
kind: L4Route
metadata:
  name: tcp-app-1
  namespace: spk-app-1
spec:
  protocol: TCP
  pvaAccelerationMode: full/assisted
  pvaDynamicClientPkts: 0
  pvaDynamicServerPkts: 1
  parentRefs:
  - name: my-tcp-gateway
    sectionName: foo
  rules:
  - backendRefs:
    - name: nginx-app-svc
      port: 80