Skip to content

Latest commit

 

History

History
131 lines (96 loc) · 5.31 KB

README.md

File metadata and controls

131 lines (96 loc) · 5.31 KB
OpenAirInterface AUSF 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-ausf version v2.0.0.

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
│   └── ausf.yaml (to deploy the operator)
├── Dockerfile  
├── package
│   └── ausfdeploy.yaml (Standalone deployment of AUSF operator)
├── README.md
└── requirements.txt (All the needed python dependencies)

Functioning

NOTE: The controller is listening to nephio proposed crd workload.nephio.org_ausfdeployments.yaml cluster wide. This CRD is based on AMF/SMF/UPF CRD proposed by nephio. Officially they have proposed CRD for NRF/AUSF/UDR/UDM. 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

TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"
NF_TYPE=str(os.getenv('NF_TYPE','ausf'))      ## 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}.yaml"))  ## 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 = str(os.getenv('TESTING','yes'))    ## If testing the network function, it will remove the init container which checks for NRFs availability
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
KUBERNETES_BASE_URL = str(os.getenv('KUBERNETES_BASE_URL','http://127.0.0.1:8080'))

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, ausf.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-ausf-controller:v2.0.0 . --no-cache

Create the CRD

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

Start the controller

kubectl create -f deployment/ausf.yaml

Create the resource

kubectl create -f package/ausfdeploy.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/ausf.yaml and copy it to two different files and configure the env parameters

export OP_CONF_PATH='/path-to/op/ausf.yaml'
export NF_CONF_PATH='/path-to/nf/ausf.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 ausfdeployments.workload.nephio.org oai-ausf -p '{"metadata": {"finalizers": []}}' --type merge