This directory contains sample Nephio controllers for Network Function deployment
There are three controllers for this package:
-
nfdeployment controller: processes NfDeployment custom resources (CR), mainly for high-level user intent which specifies the target cluster to deploy a NF for a specified vendor and version. The output of this controller is creation of vendor package which contains resource requirements, and a NF type common package.
-
nfresource controller: processes NfResource CRs --- per NF instance: which specifies the infrastructure resource needs for this NF
-
upf controller: processes Upf CRs --- per UPF instance: this CR specifies the UPF related deployment configurations
The prerequisite for running these controllers are the same as those specified by Nephio PoC. There are two repositories created via the PoC instruction: catalog and deployment. In the catalog repo, we will need two dummy packages: one for NF vendor specific resource and one for UPF.For now, the content of the UPF package is irrelevant, but free5gc package needs some NF defaults, such package can be found here. Note the name of these packages via
$ ~/kpt alpha rpkg get
Also, another dummy package is also needed at the deployment repo to clone for edge cluster package.
These controllers all run on Nephio management cluster. The instruction for installing Nephio management cluster (server) components can be found here.
Once the server components are installed, we then need to install the set of CRDs to your cluster. On the nephio-nf-controllers directory, do:
make install
Once this is done, we should see the following CRDs loaded on the mgmt cluster:
$ kubectl get crds | grep nephio
nfdeployments.networkfunction.nephio.io 2022-10-28T06:49:20Z
nfresources.networkfunction.nephio.io 2022-10-28T06:49:21Z
repoconfigs.baseconfig.nephio.io 2022-10-28T06:49:21Z
upfclasses.networkfunction.nephio.io 2022-10-28T06:49:21Z
upfs.networkfunction.nephio.io 2022-10-28T06:49:22Z
Note: the information from the date/time column should vary for your output
The controllers expect to have at least two of the CRs specified, a baseconfig resource named "repo" and a UpfClass resource. Example can be found under the sample directory, look for baseconfig.yaml for RepoConfig resource and upfclass.yaml for and example of UpfClass resource.
Verify these resources are created
$ kubectl get repoconfigs.baseconfig.nephio.io
NAME AGE
repo 46m
$ kubectl get upfclasses.networkfunction.nephio.io
NAME AGE
upf-class-1 46m
Run the controllers, under the nephio-nf-controllers directory, run:
make run
Note: These controllers will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
First we specify your NF deployment intent, as an example:
apiVersion: networkfunction.nephio.io/v1alpha1
kind: NfDeployment
metadata:
name: 5gc-deploy-test
spec:
sites:
- id: free5gc-upf-1
locationName: somewhere
clusterName: nephio-edge-1
nfKind: upf
nfClassName: upf-class-1
nfVendor: free5gc
nfVersion: v3.1.1
nfNamespace: upf-1
the specification above specifies a deployment of one instance of free5gc v3.1.1 UPF to cluster nephio-edge-1 and namespace upf-1 with class upf-class-1. We can simply apply this intent via:
kubectl apply -f nfdeploy.yaml
The result of applying NfDeployment resource is the creation of vendor package and a NF type (UPF in this case) specific package for each instance. For free5gc, the NfResource resource contains only Network Attachment Definition templates --- one for each of the Nx interfaces. The Upf package (auto-generated by controller) should contain the following:
apiVersion: networkfunction.nephio.io/v1alpha1
kind: Upf
metadata:
name: free5gc-upf-1
namespace: default
spec:
parent: upf-class-1
clustername: nephio-edge-1
namespace: upf-1
n3:
endpoints:
- ipv4Addr:
- "YOUR_IPv4"
gwv4addr: "YOUR_IPv4_GW"
n4:
endpoints:
- ipv4Addr:
- "YOUR_IPv4"
gwv4addr: "YOUR_IPv4_GW"
n6:
endpoints:
internet:
ipendpoints:
ipv4Addr:
- "YOUR_IPv4"
gwv4addr: "YOUR_IPv4_GW"
ipaddrpool: "YOUR_IPv4_POOL"
The YOUR_XXX fields should be input by user afterward. Once the input for these packages are done, we can push the packages to deployment repo via
kpt alpha rpkg propose <NAD package> -ndefault
kpt alpha rpkg approve <NAD package> -ndefault
On the edge cluster, verify these NADs are loaded:
$ kubectl get network-attachment-definitions -n upf-1
NAME AGE
free5gc-upf-1-n3 17s
free5gc-upf-1-n4 17s
free5gc-upf-1-n6 17s
then push the UPF package:
kpt alpha rpkg propose <UPF package> -ndefault
kpt alpha rpkg approve <UPF package> -ndefault
On the edge cluster, verify that UPF is running:
$ kubectl get all -n upf-1
NAME READY STATUS RESTARTS AGE
pod/free5gc-upf-1-78c67dc499-z7fk2 1/1 Running 0 11s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/free5gc-upf-1 1/1 1 1 11s
NAME DESIRED CURRENT READY AGE
replicaset.apps/free5gc-upf-1-78c67dc499 1 1 1 11s
Copyright 2022.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.