Skip to content

Latest commit

 

History

History
134 lines (98 loc) · 5.29 KB

README.md

File metadata and controls

134 lines (98 loc) · 5.29 KB
OpenAirInterface UDR Operator

The operator is designed using kopf. The operator is completely written in python. At the moment the operator is highly experimental and designed for orchestration via nephio.

It can be used for oai-udr version v1.5.1.

NOTE: So far we have only tested the operator on a minikube cluster.

The directory structure is below:

.
├── controllers
│   ├── controller.py (Main controller logic)
│   └── utils.py (Supporting functions)
├── deployment
│   └── udr.yaml (to deploy the operator)
├── Dockerfile  
├── package
│   └── udrdeploy.yaml (Standalone deployment of UDR operator)
├── README.md
└── requirements.txt (All the needed python dependencies)

Functioning

NOTE: The controller is listening to nephio proposed crd workload.nephio.org_udrdeployments.yaml cluster wide. This CRD is based on AMF/SMF/UPF CRD proposed by nephio. Officially they have proposed CRD for NRF/UDR/UDM/AUSF. In the future it will listen to OAI proposed CRDs also.

Controller requires configuration file of the network function and it allows configuring certain config parameters when the controller is deployed. The controller requires two configmaps when running inside a pod or during development phase you can just provide the path of the network function configuration file and the controllers configuration file. The reason of having controllers configuration file is to only expose some important paramters to configure the network function rather than exposing all the parameters.

The idea of this controller is not to expose multiple configuration paramters but to easily deploy the network function with less efforts from the user.

There are some environment parameters which are used by the controller to configure network function configuration files. They are present in utils.py

HTTPS_VERIFY = bool(os.getenv('HTTPS_VERIFY',False)) ## To verfiy HTTPs certificates when communicating with cluster
TOKEN=os.popen('cat /var/run/secrets/kubernetes.io/serviceaccount/token').read() ## Token used to communicate with Kube cluster
NF_TYPE=str(os.getenv('NF_TYPE','udr'))      ## Network function name
LABEL={'workload.nephio.org/oai': f"{NF_TYPE}"}   ## Labels to put inside the owned resources
OP_CONF_PATH=str(os.getenv('OP_CONF_PATH',f"/tmp/op/{NF_TYPE}.yaml"))  ## Operators configuration file
NF_CONF_PATH = str(os.getenv('NF_CONF_PATH',f"/tmp/nf/{NF_TYPE}.conf"))  ## Network function configuration file
DEPLOYMENT_FETCH_INTERVAL=int(os.getenv('DEPLOYMENT_FETCH_INTERVAL',1)) # Fetch the status of deployment every x seconds
DEPLOYMENT_FETCH_ITERATIONS=int(os.getenv('DEPLOYMENT_FETCH_ITERATIONS',100))  # Number of times to fetch the deployment
LOG_LEVEL = str(os.getenv('LOG_LEVEL','INFO'))    ## Log level of the controller
TESTING = bool(os.getenv('TESTING','yes'))    ## If testing the network function, it will remove the init container which checks for NRFs availability

In case of docker pull limit on your network better to use pull secrets, just authenticated with the docker hub. You can add the pull secret in the operator configuration, udr.yaml in configmap like below

    imagePullSecrets:
      - name: test

NOTE: All the network function controllers except upf and nrf have the same functioning. Though they have a seperate code base but its still similar at the moment.

Deployment

The image is still not hosted on public respositories so you have to create an image

docker build -f Dockerfile -t oai-udr-controller:v1.5.1 . --no-cache

oai-udr depends on mysql as database to store subscriber information:

helm install mysql ../../mysql

Create the CRD

kubectl create -f ../../crd/workload.nephio.org_udrdeployments.yaml

Start the controller

kubectl create -f deployment/udr.yaml

Create the resource

kubectl create -f package/udrdeploy.yaml

Development environment

For development it is good to use virtual python environment, I am using virtualenv

sudo apt install virtalenv
virtualenv -p python3 -m venv

Install the requirements

pip install -r requirements.txt

Make sure you copy operators yaml configuration file network functions .conf from deployment/udr.yaml and copy it to two different files and configure the env parameters

export OP_CONF_PATH='/path-to/op/udr.yaml'
export NF_CONF_PATH='/path-to/nf/udr.conf'

Now start the operator

kopf run controllers/controller.py --verbose

Note

In case you are not able to remove the package because the finalizer is blocking it then you can patch

kubectl patch udrdeployments.workload.nephio.org oai-udr -p '{"metadata": {"finalizers": []}}' --type merge