Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/lint-helm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Lint Helm Chart

on:
pull_request:
branches:
- main
push:
branches:
- main

jobs:
lint-helm:
runs-on: ubuntu-latest
env:
CHART_PATH: charts/open5gs-operator
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.18.4

- name: Lint Helm chart
run: helm lint $CHART_PATH

- name: Update Helm dependencies
run: helm dep update $CHART_PATH
93 changes: 93 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Build and Publish Docker Image & Helm Chart

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-publish:
runs-on: ubuntu-latest
env:
IMAGE_NAME: gradiant/open5gs-operator
CHART_PATH: charts/open5gs-operator
CHART_REPO: oci://registry-1.docker.io/gradiantcharts
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract version from Makefile
id: version
run: |
VERSION=$(grep -E '^VERSION[[:space:]]*\?=' Makefile | head -1 | sed 's/.*= *//')
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}

- name: Push Docker image
if: github.event_name == 'push'
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_NAME }}:latest,${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Install Helm
uses: azure/setup-helm@v4
with:
version: v3.18.4

- name: Lint Helm chart
run: helm lint $CHART_PATH

- name: Update Helm dependencies
run: helm dep update $CHART_PATH

- name: Generate Helm chart
run: |
make helm

- name: Package Helm chart
run: |
helm package $CHART_PATH --destination packaged-charts

- name: Helm registry login (DockerHub)
if: github.event_name == 'push'
run: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | helm registry login registry-1.docker.io -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Push Helm chart to DockerHub OCI registry
if: github.event_name == 'push'
run: |
helm push packaged-charts/open5gs-operator-${{ steps.version.outputs.version }}.tgz $CHART_REPO

- name: Upload Helm chart as artifact
uses: actions/upload-artifact@v4
with:
name: open5gs-operator-chart
path: packaged-charts/*.tgz
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ The operator provides full management of Open5GS subscribers, including configur

## How to Install

To install by using Helm, you can use the Helm chart provided in the `charts` directory or the open5gs-operator-1.0.1.tgz file. The chart is also available in the Gradiant Charts repository.
To install by using Helm, you can use the Helm chart provided in the `charts` directory or the open5gs-operator-1.0.4.tgz file. The chart is also available in the Gradiant Charts repository.
```bash
helm install open5gs-operator oci://registry-1.docker.io/gradiantcharts/open5gs-operator --version 1.0.1
helm install open5gs-operator oci://registry-1.docker.io/gradiantcharts/open5gs-operator --version 1.0.4
```

To uninstall the operator, run:
Expand Down Expand Up @@ -112,4 +112,20 @@ A complete demo with UERANSIM is available at [this link](https://gradiant.githu
7. The `webuiImage` field in the CR specifies the version of the Open5GS WebUI image. If not specified, the operator defaults to version `docker.io/gradiant/open5gs-webui:2.7.5`.
8. The `mongoDBVersion` field in the CR specifies the version of the MongoDB image. If not specified, the operator defaults to version `bitnami/mongodb:8.0.6-debian-12-r0`.
9. Components with metric support can generate a `ServiceMonitor` CR to expose metrics to Prometheus. However, ensure that the `ServiceMonitor` CRD is installed in the cluster; otherwise, the operator will encounter an error and fail to create the resource. To create a ServiceMonitor, set the `serviceMonitor` field to `true` in the CR for the desired component.
10. **UPF Deployment Annotations:** The annotations for the UPF Deployment are managed exclusively through the `upf.deploymentAnnotations` field in the CR. Any annotation not present in this field will be automatically reconciled by the operator (added or removed as needed), so manual changes to annotations will not persist unless reflected in the CR.
11. **UPF GTP-U Interface:** The GTP-U network interface used by the UPF is set via the `upf.gtpuDev` field in the CR (e.g., `gtpuDev: "eth0"`). By default, the UPF uses the `eth0` interface.

## How to create a new release

To publish a new version of the operator, follow these steps:

1. Make the necessary changes in the code.
2. Run the version script:
```bash
./set-version.sh <new_version>
```
This will update the version in all relevant files (Makefile, kustomization.yaml, Chart.yaml, and values.yaml).
3. Commit the changes and create the corresponding Pull Request (PR).

This ensures that the published version is consistent with the code and manifests.

12 changes: 7 additions & 5 deletions api/v1/open5gs_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@ type Open5GSSlice struct {
}

type Open5GSFunction struct {
Enabled *bool `json:"enabled,omitempty" default:"true"`
ServiceAccount *bool `json:"serviceAccount,omitempty" default:"false"`
Metrics *bool `json:"metrics,omitempty" default:"true"`
ServiceMonitor *bool `json:"serviceMonitor,omitempty" default:"false"`
Service []Open5GSService `json:"service,omitempty" default:"{\"name\":\"\",\"port\":0,\"serviceType\":\"\"}"`
Enabled *bool `json:"enabled,omitempty" default:"true"`
ServiceAccount *bool `json:"serviceAccount,omitempty" default:"false"`
Metrics *bool `json:"metrics,omitempty" default:"true"`
ServiceMonitor *bool `json:"serviceMonitor,omitempty" default:"false"`
Service []Open5GSService `json:"service,omitempty" default:"{\"name\":\"\",\"port\":0,\"serviceType\":\"\"}"`
GTPUDev string `json:"gtpuDev,omitempty" default:"eth0"`
DeploymentAnnotations map[string]string `json:"deploymentAnnotations,omitempty"`
}

type Open5GSService struct {
Expand Down
7 changes: 7 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions charts/open5gs-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: open5gs-operator
description: A Helm chart for Kubernetes
type: application
version: 1.0.3
appVersion: "1.0.3"
version: 1.0.4
appVersion: "1.0.4"
78 changes: 78 additions & 0 deletions charts/open5gs-operator/templates/open5gs-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ spec:
properties:
amf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -62,8 +68,14 @@ spec:
type: object
ausf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -82,8 +94,14 @@ spec:
type: object
bsf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand Down Expand Up @@ -124,8 +142,14 @@ spec:
type: object
mongoDB:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -146,8 +170,14 @@ spec:
type: string
nrf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -166,8 +196,14 @@ spec:
type: object
nssf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -188,8 +224,14 @@ spec:
type: string
pcf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -208,8 +250,14 @@ spec:
type: object
scp:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -228,8 +276,14 @@ spec:
type: object
smf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -248,8 +302,14 @@ spec:
type: object
udm:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -268,8 +328,14 @@ spec:
type: object
udr:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -288,8 +354,14 @@ spec:
type: object
upf:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand All @@ -308,8 +380,14 @@ spec:
type: object
webui:
properties:
deploymentAnnotations:
additionalProperties:
type: string
type: object
enabled:
type: boolean
gtpuDev:
type: string
metrics:
type: boolean
service:
Expand Down
Loading