Network Function
Examples
Network function matching P4 targets with architecture v1model:
apiVersion: core.loom.io/v1alpha1
kind: NetworkFunction
metadata:
name: example-nf
spec:
p4File: https://example.org/p4program.p4
targetSelector:
p4target.loom.io/arch: v1model
Creating a network function referencing a NetworkFunctionConfig named example-nf-config:
apiVersion: core.loom.io/v1alpha1
kind: NetworkFunction
metadata:
name: example-nf
spec:
p4File: https://example.org/p4program.p4
configRef:
name: example-nf-config
Scheduling a network function on a specific P4 target named example-target:
apiVersion: core.loom.io/v1alpha1
kind: NetworkFunction
metadata:
name: example-nf
spec:
p4File: https://example.org/p4program.p4
targetName: example-target
Network function matching P4 targets with architecture v1model and with control plane pod:
apiVersion: core.loom.io/v1alpha1
kind: NetworkFunction
metadata:
name: example-nf
spec:
p4File: https://example.org/p4program.p4
targetSelector:
p4target.loom.io/arch: v1model
controlPlane:
image: example-control-plane-image:latest
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: "500m"
memory: "256Mi"
limits:
cpu: "1"
memory: "512Mi"
Spec fields
p4File: The actual P4 program file for the network function. It can be the actual p4program encoded in base64 or a s3://, http:// or https:// URL pointing to the P4 file location.targetName: An optional field that can be used to specify the name of the P4Target where this NetworkFunction instance should be scheduled. If not specified, the scheduler will automatically select a suitable P4Target based on the TargetSelector.controlPlane: Optional field to define the template for the control plane pod of the network function.imageis the container image for the control plane pod of the network function.imagePullPolicydefines the image pull policy for the control plane pod. The default value isIfNotPresent.resourcesdefines the resource requests and limits for the control plane pod.nodeNamespecifies the name of the node where the control plane pod should be scheduled. If specified, the scheduler will attempt to schedule the pod on the specified node.nodeSelectordefines the node selector for the control plane pod.tolerationsdefines the tolerations for the control plane pod.affinitydefines the affinity rules for the control plane pod.extraEnvdefines extra environment variables for the control plane pod. By default, the control plane pod will have theNF_NAMEandNF_NAMESPACEenvironment variables set to the name and namespace of the NetworkFunction instance, respectively. This field can be used to add additional environment variables as needed.argsdefines the command-line arguments for the control plane pod.
targetSelector: Used to select P4 targets based on their supported architectures, or other labels. The scheduler will use this selector to find suitable P4 targets for scheduling the NetworkFunction instance. A built-in label that can be used in the target selector isp4target.loom.io/archfor selecting P4 targets based on their architecture (e.g.,v1model,psa, etc.).configRef: An optional reference to a NetworkFunctionConfig resource that contains the configurations for this network function. If specified, the driver will automatically apply the configuration from the referenced NetworkFunctionConfig to this NetworkFunction instance.
Status fields
observedGeneration: The most recent generation observed for this NetworkFunction. This is used to determine if the status is up-to-date with the spec.phase: Indicates the current phase of the NetworkFunction. Possible values includePending,Running, andFailed.conditions: Represents the latest available observations of the NetworkFunction's current state. Each condition has a type (e.g.,Initialized,Ready,Scheduled,DisruptionTarget,ReadyToStart), a status (True, False, Unknown), and optional fields for the last probe time, last transition time, reason, and message.assignedIPis the IP address assigned to the NetworkFunction, used for routing traffic to it.