Skip to content

Commit

Permalink
Fix free5GC tests and dedup SMF configrefs
Browse files Browse the repository at this point in the history
Also:

* Update README to install ref.nephio.org Config
* Upgrade to Go 1.21.6
* Remove old and unused CRD files
* Match AMF code style to that of the other NFs
* Small fixes to log and error messages
  • Loading branch information
tliron committed Feb 1, 2024
1 parent e4956fe commit 052933d
Show file tree
Hide file tree
Showing 32 changed files with 159 additions and 2,122 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the operator binary
FROM golang:1.20.5 as builder
FROM golang:1.21.6 as builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -20,7 +20,7 @@ COPY controllers/ controllers/
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o free5gc-operator -C free5gc-operator/
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -C free5gc-operator/ -a -o free5gc-operator

# Use distroless as minimal base image to package the operator binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GO_VERSION ?= 1.20.5
GO_VERSION ?= 1.21.6
GOLANG_CI_VER ?= v1.52
GOSEC_VER ?= 2.15.0
TEST_COVERAGE_FILE=lcov.info
Expand Down Expand Up @@ -72,7 +72,8 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=free5gc-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=free5gc-operator-role webhook paths="./..."
# $(CONTROLLER_GEN) rbac:roleName=free5gc-operator-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down Expand Up @@ -156,13 +157,13 @@ docker-push: ## Push docker image with the operator.

##@ Deployment

.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
# .PHONY: install
# install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
# $(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -

.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
# .PHONY: uninstall
# uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
# $(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
free5gc-operator
================

free5GC operator for Nephio.
A Kubernetes operator for [free5GC](https://free5gc.org/).

Description
-----------

The Nephio free5GC operator takes the Nephio community produced XXXDeployment (where XXX = AMF | SMF | UPF) custom resources, and deploys the corresponding free5GC AMF | SMF | UPF onto the cluster based on the CR's specifications.
Manages deployments of free5GC's AMF, SMF, and UPF network functions by reconciling Nephio's
`NFDeployment` custom resources for the `amf.free5gc.io`, `smf.free5gc.io`, and `upf.free5gc.io`
providers.

Getting Started
---------------

Prior to running the free5GC operator, Multus needs to be installed on cluster with the macvlan CNI.

### Deploy the CRDs

We need the Nephio API CRDs from the [api repository](https://github.com/nephio-project/api):

```sh
make install
TAG=main
kubectl apply -f https://raw.githubusercontent.com/nephio-project/api/$TAG/config/crd/bases/workload.nephio.org_nfdeployments.yaml
kubectl apply -f https://raw.githubusercontent.com/nephio-project/api/$TAG/config/crd/bases/workload.nephio.org_nfconfigs.yaml
kubectl apply -f https://raw.githubusercontent.com/nephio-project/api/$TAG/config/crd/bases/ref.nephio.org_configs.yaml
```

(Replace `TAG` with a specific tagged version, e.g. `v2.0.0`)

### Run the Operator

Multus needs to be installed on cluster with the "macvlan" CNI plugin.

For testing, you can run the operator locally against the cluster:

```sh
make run
```

### Deploy the Operator

Use your own Docker Hub registry:
Or you can build an image:

```sh
make docker-build docker-push REGISTRY=myregistry
```

Then deploy to the cluster:
(Use your own Docker Hub registry)

Then deploy it the cluster:

```sh
make deploy REGISTRY=myregistry
Expand All @@ -47,8 +56,8 @@ make deploy REGISTRY=myregistry
kubectl apply -f test/
```


## License
License
-------

Copyright 2023 The Nephio Authors.

Expand Down
Loading

0 comments on commit 052933d

Please sign in to comment.