feat(jarvis): Add Jarvis Test Artifacts

This PS adds test artifacts to be used to validate Jarvis
operation: The Open5GS 5G SA Core.

Change-Id: I33d3ac2b2c584320aa3b0ca928657496ccd96303
Signed-off-by: Pete Birley <pete@port.direct>
This commit is contained in:
Pete Birley 2021-01-18 17:28:54 -06:00 committed by Pete Birley
parent 06ae5e2db7
commit 342e7e09c8
85 changed files with 4732 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -ex
: "${image_registry:="quay.io"}"
: "${image_repo:="port"}"
: "${image_prefix:="open5gs"}"
: "${image_tag:="latest"}"
: "${push_images:="false"}"
for dockerfile_path in `find ./tools/gate/jarvis/5G-SA-core -name Dockerfile`; do
build_root=`dirname ${dockerfile_path}`
network_function=`echo $build_root | awk -F '/' '{ print $NF }'`
image_uri="${image_registry}/${image_repo}/${image_prefix}-${network_function}:${image_tag}"
sudo docker build -t "${image_uri}" "${build_root}"
if [[ "${push_images}" == "true" ]]; then
docker push "${image_uri}"
fi
done

View File

@ -0,0 +1,7 @@
#!/bin/bash
set -ex
for chart_path in `find ./tools/gate/jarvis/5G-SA-core -name Chart.yaml -exec dirname {} \;`; do
helm lint ${chart_path}
helm template ${chart_path} > /dev/null
done

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -ex
: "${kube_namespace:="open5gs"}"
for network_function in `find ./tools/gate/jarvis/5G-SA-core -maxdepth 1 -type d | tail -n +2 | awk -F '/' '{ print $NF }'`; do
helm upgrade \
--create-namespace \
--install \
--namespace="${kube_namespace}" \
"${network_function}" \
"./tools/gate/jarvis/5G-SA-core/${network_function}/charts/${network_function}"
done
./tools/deployment/common/wait-for-pods.sh "${kube_namespace}"

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: amf
description: A Helm chart for the Open5gs AMF
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-AMF" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-AMF" ) }}

View File

@ -0,0 +1,52 @@
{{- define "Deployment-AMF" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-AMF.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "amf" ) | nindent 8 }}
containers:
- name: amf
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "amf" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-amfd
args:
- -c
- /etc/open5gs/amf.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/amf.yaml
subPath: amf.yaml
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "amf.yaml" "amf" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "amf.yaml" "amf" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: amf.yaml
path: amf.yaml
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-AMF" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-AMF" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "amf.yaml" "amf" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-AMF" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,322 @@
images:
applications:
amf:
tag: latest
name: port/open5gs-amf
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
amf:
key: kubernetes.io/os
value: linux
config:
amf.yaml:
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,ngap,nas,gmm,sbi,amf,event,tlv,mem,sock
#
logger:
file: /dev/stdout
level: debug
#
# amf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: amf.key
# pem: amf.pem
#
# o SBI Server(https://127.0.0.5:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.5
# tls:
# key: amf.key
# pem: amf.pem
# - addr: ::1
#
# o SBI Server(http://amf.open5gs.org:80)
# sbi:
# name: amf.open5gs.org
#
# o SBI Server(http://127.0.0.5:7777)
# sbi:
# - addr: 127.0.0.5
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
# <NGAP Server>>
#
# o NGAP Server(all address avaiable)
# ngap:
#
# o NGAP Server(0.0.0.0:38412)
# ngap:
# addr: 0.0.0.0
#
# o NGAP Server(127.0.0.5:38412, [::1]:38412)
# ngap:
# - addr: 127.0.0.5
# - addr: ::1
#
# o NGAP Server(different port)
# ngap:
# - addr: 127.0.0.5
# port: 38413
#
# o NGAP Server(address avaiable in `eth0` interface)
# ngap:
# dev: eth0
#
# <GUAMI>
#
# o Multiple GUAMI
# guami:
# - plmn_id:
# mcc: 901
# mnc: 70
# amf_id:
# region: 2
# set: 1
# pointer: 4
# - plmn_id:
# mcc: 001
# mnc: 01
# amf_id:
# region: 5
# set: 2
#
# <TAI>
#
# o Multiple TAI
# tai:
# - plmn_id:
# mcc: 001
# mnc: 01
# tac: [1, 2, 3]
# tai:
# - plmn_id:
# mcc: 002
# mnc: 02
# tac: 4
# - plmn_id:
# mcc: 003
# mnc: 03
# tac: 5
# tai:
# - plmn_id:
# mcc: 004
# mnc: 04
# tac: [6, 7]
# - plmn_id:
# mcc: 005
# mnc: 05
# tac: 8
# - plmn_id:
# mcc: 006
# mnc: 06
# tac: [9, 10]
#
# <PLMN Support>
#
# o Multiple PLMN Support
# plmn_support:
# - plmn_id:
# mcc: 901
# mnc: 70
# s_nssai:
# - sst: 1
# - sd: 010000
# - plmn_id:
# mcc: 901
# mnc: 70
# s_nssai:
# - sst: 1
#
# <Network Name>
#
# network_name:
# full: Open5GS
# short: Next
#
# <AMF Name>
#
# amf_name: amf1.open5gs.amf.5gc.mnc70.mcc901.3gppnetwork.org
#
amf:
sbi:
addr:
- 0.0.0.0
port: 7777
ngap:
- addr: 127.0.0.5 # for external gNB - a local address that can be reached by the gNB
guami:
- plmn_id:
mcc: 001 # set your PLMN-MCC
mnc: 01 # set your PLMN-MNC
amf_id:
region: 2
set: 1
tai:
- plmn_id:
mcc: 001 # set your PLMN-MCC
mnc: 01 # set your PLMN-MNC
tac: 1 # should match the TAC used by your gNB
plmn_support:
- plmn_id:
mcc: 901
mnc: 70
s_nssai:
- sst: 1
security:
integrity_order : [ NIA2, NIA1, NIA0 ]
ciphering_order : [ NEA0, NEA1, NEA2 ]
network_name:
full: Open5GS
amf_name: open5gs-amf0
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%lo]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%lo
#
nrf:
sbi:
- name: nrf
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-amf ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-amfd"]
CMD ["-c", "/etc/open5gs/amf.yaml"]

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: ausf
description: A Helm chart for the Open5gs AUSF
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-AUSF" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-AUSF" ) }}

View File

@ -0,0 +1,52 @@
{{- define "Deployment-AUSF" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-AUSF.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "ausf" ) | nindent 8 }}
containers:
- name: ausf
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "ausf" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-ausfd
args:
- -c
- /etc/open5gs/ausf.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/ausf.yaml
subPath: ausf.yaml
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "ausf.yaml" "ausf" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "ausf.yaml" "ausf" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: ausf.yaml
path: ausf.yaml
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-AUSF" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-AUSF" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "ausf.yaml" "ausf" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-AUSF" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,198 @@
images:
applications:
ausf:
tag: latest
name: port/open5gs-ausf
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
ausf:
key: kubernetes.io/os
value: linux
config:
ausf.yaml:
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,ausf,event,tlv,mem,sock
#
logger:
file: /dev/stdout
level: debug
#
# ausf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: ausf.key
# pem: ausf.pem
#
# o SBI Server(https://127.0.0.11:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.11
# tls:
# key: ausf.key
# pem: ausf.pem
# - addr: ::1
#
# o SBI Server(http://ausf.open5gs.org:80)
# sbi:
# name: ausf.open5gs.org
#
# o SBI Server(http://127.0.0.11:7777)
# sbi:
# - addr: 127.0.0.11
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
ausf:
sbi:
addr:
- 0.0.0.0
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%lo]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%lo
#
nrf:
sbi:
- name: nrf
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-ausf ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-ausfd"]
CMD ["-c", "/etc/open5gs/ausf.yaml"]

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: mongodb
description: A Helm chart for MongoDB
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-MongoDB" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-MongoDB" ) }}

View File

@ -0,0 +1,56 @@
{{- define "Deployment-MongoDB" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-MongoDB.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "mongodb" ) | nindent 8 }}
containers:
- name: mongodb
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "mongodb" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/mongod
args:
- --config
- /etc/mongo/mongod.conf
volumeMounts:
- name: config
mountPath: /etc/mongo/mongod.conf
subPath: mongod.conf
- name: data
mountPath: /var/lib/mongodb
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "mongod.conf" "net" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "mongod.conf" "net" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: mongod.conf
path: mongod.conf
- name: data
emptyDir: {}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-MongoDB" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-MongoDB" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "mongod.conf" "net" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-MongoDB" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,63 @@
images:
applications:
mongodb:
tag: latest
name: port/open5gs-mongodb
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
mongodb:
key: kubernetes.io/os
value: linux
config:
mongod.conf:
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where and how to store data.
storage:
dbPath: /var/lib/mongodb
# journal:
# enabled: true
# engine:
# mmapv1:
# wiredTiger:
# where to write logging data.
# systemLog:
# destination: file
# logAppend: true
# path: /var/log/mongodb/mongod.log
# network interfaces
net:
port: 27017
bindIp: 0.0.0.0
# how the process runs
# processManagement:
# timeZoneInfo: /usr/share/zoneinfo
#security:
#operationProfiling:
#replication:
#sharding:
## Enterprise-Only Options:
#auditLog:
#snmp:
over_rides: {}

View File

@ -0,0 +1,2 @@
ARG FROM=docker.io/library/mongo:4.4.3-bionic
FROM $FROM

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: nrf
description: A Helm chart for the Open5gs NRF
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-NRF" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-NRF" ) }}

View File

@ -0,0 +1,52 @@
{{- define "Deployment-NRF" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-NRF.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "nrf" ) | nindent 8 }}
containers:
- name: nrf
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "nrf" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-nrfd
args:
- -c
- /etc/open5gs/nrf.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/nrf.yaml
subPath: nrf.yaml
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "nrf.yaml" "nrf" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "nrf.yaml" "nrf" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: nrf.yaml
path: nrf.yaml
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-NRF" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-NRF" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "nrf.yaml" "nrf" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-NRF" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,184 @@
images:
applications:
nrf:
tag: latest
name: port/open5gs-nrf
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
nrf:
key: kubernetes.io/os
value: linux
config:
nrf.yaml:
db_uri: mongodb://mongodb/open5gs
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,nrf,event,mem,sock
#
logger:
level: debug
file: /dev/stdout
#
# nrf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:7777)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: nrf.key
# pem: nrf.pem
#
# o SBI Server(https://127.0.0.10:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - addr: ::1
#
# o SBI Server(http://nrf.open5gs.org:80)
# sbi:
# name: nrf.open5gs.org
#
# o SBI Server(http://127.0.0.10:7777)
# sbi:
# - addr: 127.0.0.10
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
nrf:
sbi:
addr:
- 0.0.0.0
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
#
# o NF Instance Heartbeat (5 seconds)
# nf_instance:
# heartbeat: 5
#
# o NF Instance Validity (Default : 3600 seconds = 1 hour)
#
# o NF Instance Validity (10 seconds)
# nf_instance:
# validity: 10
#
# o Subscription Validity (Default : 86400 seconds = 1 day)
#
# o Subscription Validity (Disabled)
# subscription:
# validity: 0
#
# o Subscription Validity (3600 seconds = 1 hour)
# subscription:
# validity: 3600
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-nrf ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-nrfd"]
CMD ["-c", "/etc/open5gs/nrf.yaml"]

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: pcf
description: A Helm chart for the Open5gs PCF
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-PCF" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-PCF" ) }}

View File

@ -0,0 +1,52 @@
{{- define "Deployment-PCF" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-PCF.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "pcf" ) | nindent 8 }}
containers:
- name: pcf
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "pcf" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-pcfd
args:
- -c
- /etc/open5gs/pcf.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/pcf.yaml
subPath: pcf.yaml
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "pcf.yaml" "pcf" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "pcf.yaml" "pcf" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: pcf.yaml
path: pcf.yaml
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-PCF" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-PCF" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "pcf.yaml" "pcf" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-PCF" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,200 @@
images:
applications:
pcf:
tag: latest
name: port/open5gs-pcf
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
pcf:
key: kubernetes.io/os
value: linux
config:
pcf.yaml:
db_uri: mongodb://mongodb/open5gs
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,pcf,event,tlv,mem,sock
#
logger:
file: /dev/stdout
level: debug
#
# pcf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: pcf.key
# pem: pcf.pem
#
# o SBI Server(https://127.0.0.13:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.13
# tls:
# key: pcf.key
# pem: pcf.pem
# - addr: ::1
#
# o SBI Server(http://pcf.open5gs.org:80)
# sbi:
# name: pcf.open5gs.org
#
# o SBI Server(http://127.0.0.13:7777)
# sbi:
# - addr: 127.0.0.13
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
pcf:
sbi:
addr:
- 0.0.0.0
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%lo]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%lo
#
nrf:
sbi:
- name: nrf
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-pcf ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-pcfd"]
CMD ["-c", "/etc/open5gs/pcf.yaml"]

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: smf
description: A Helm chart for the Open5gs SMF
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-SMF" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-SMF" ) }}

View File

@ -0,0 +1,57 @@
{{- define "Deployment-SMF" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-SMF.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "smf" ) | nindent 8 }}
containers:
- name: smf
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "smf" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-smfd
args:
- -c
- /etc/open5gs/smf.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/smf.yaml
subPath: smf.yaml
- name: config
mountPath: {{ index $.Values.config "smf.yaml" "smf" "freeDiameter" }}
subPath: smf.conf
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "smf.yaml" "smf" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "smf.yaml" "smf" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: smf.yaml
path: smf.yaml
- key: smf.conf
path: smf.conf
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-SMF" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-SMF" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "smf.yaml" "smf" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-SMF" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,636 @@
images:
applications:
smf:
tag: latest
name: port/open5gs-smf
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
smf:
key: kubernetes.io/os
value: linux
config:
smf.yaml:
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,pfcp,fd,pfcp,gtp,smf,event,tlv,mem,sock
#
logger:
file: /dev/stdout
level: debug
#
# smf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: smf.key
# pem: smf.pem
#
# o SBI Server(https://127.0.0.4:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.4
# tls:
# key: smf.key
# pem: smf.pem
# - addr: ::1
#
# o SBI Server(http://smf.open5gs.org:80)
# sbi:
# name: smf.open5gs.org
#
# o SBI Server(http://127.0.0.4:7777)
# sbi:
# - addr: 127.0.0.4
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
# <PFCP Server>
#
# o PFCP Server(127.0.0.4:8805, ::1:8805)
# pfcp:
# - addr: 127.0.0.4
# - addr: ::1
#
# <GTP-C Server>
#
# o GTP-C Server(127.0.0.4:2123, [fe80::3%lo]:2123)
# gtpc:
# addr:
# - 127.0.0.4
# - fe80::3%lo
#
# o On SMF, Same configuration
# (127.0.0.4:2123, [fe80::3%lo]:2123).
# gtpc:
# - addr: 127.0.0.4
# - addr: fe80::3%lo
#
# <PDN Configuration with UE Pool>
#
# o IPv4 Pool
# pdn:
# addr: 10.45.0.1/16
#
# o IPv4/IPv6 Pool
# pdn:
# - addr: 10.45.0.1/16
# - addr: cafe:1::1/64
#
#
# o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, cafe:2::1/64
# pdn:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
# dnn: internet
# - addr: 10.46.0.1/16
# dnn: ims
# - addr: cafe:2::1/64
# dnn: ims
#
# o Multiple Devices (default: ogstun)
# pdn:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
# dnn: internet
# dev: ogstun2
# - addr: 10.46.0.1/16
# dnn: ims
# dev: ogstun3
# - addr: cafe:2::1/64
# dnn: ims
# dev: ogstun3
#
# o Pool Range Sample
# pdn:
# - addr: 10.45.0.1/24
# range: 10.45.0.100-10.45.0.200
#
# pdn:
# - addr: 10.45.0.1/24
# range:
# - 10.45.0.5-10.45.0.50
# - 10.45.0.100-
#
# pdn:
# - addr: 10.45.0.1/24
# range:
# - -10.45.0.200
# - 10.45.0.210-10.45.0.220
#
# pdn:
# - addr: 10.45.0.1/16
# range:
# - 10.45.0.100-10.45.0.200
# - 10.45.1.100-10.45.1.200
# - addr: cafe::1/64
# range:
# - cafe::a0-cafe:b0
# - cafe::c0-cafe:d0
#
# <Domain Name Server>
#
# o Primary/Secondary can be configured. Others are ignored.
#
# <MTU Size>
#
# o Provisioning a limit on the size of the packets sent by the MS
# to avoid packet fragmentation in the backbone network
# between the MS and the GGSN/PGW and/or across the (S)Gi reference point)
# when some of the backbone links does not support
# packets larger then 1500 octets
#
# <P-CSCF>
#
# o Proxy Call Session Control Function
#
# p-cscf:
# - 127.0.0.1
# - ::1
#
smf:
sbi:
addr:
- 0.0.0.0
port: 7777
gtpc:
- addr: 127.0.0.4
pfcp:
- addr: 127.0.0.4
pdn:
- addr: 10.45.0.1/16
dns:
- 8.8.8.8
- 8.8.4.4
mtu: 1400
freeDiameter: /etc/freeDiameter/smf.conf
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.1:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%lo]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%lo
#
nrf:
sbi:
- name: nrf
port: 7777
#
# upf:
#
# <PFCP Client>>
#
# o PFCP Client(127.0.0.7:8805)
#
# pfcp:
# addr: 127.0.0.7
#
# <UPF_SELECTION_MODE - EPC only>
#
# o Round-Robin
# (note that round robin can be disabled for a particular node
# by setting flag 'rr' to 0)
#
# upf:
# pfcp:
# - addr: 127.0.0.7
# - addr: 127.0.0.12
# rr: 0
# - addr: 127.0.0.19
#
# o UPF selection by eNodeB TAC
# (either single TAC or multiple TACs, DECIMAL representation)
#
# upf:
# pfcp:
# - addr: 127.0.0.7
# tac: 1
# - addr: 127.0.0.12
# tac: [3,5,8]
#
# o UPF selection by UE's DNN/APN (either single DNN/APN or multiple DNNs/APNs)
#
# upf:
# pfcp:
# - addr: 127.0.0.7
# dnn: ims
# - addr: 127.0.0.12
# dnn: [internet, web]
#
# o UPF selection by CellID(e_cell_id: 28bit, nr_cell_id: 36bit)
# (either single enb_id or multiple enb_ids, HEX representation)
#
# upf:
# pfcp:
# - addr: 127.0.0.7
# e_cell_id: 463
# - addr: 127.0.0.12
# nr_cell_id: [123456789, 9413]
#
upf:
pfcp:
- addr: 127.0.0.7
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
smf.conf: |
# This is a sample configuration file for freeDiameter daemon.
# Most of the options can be omitted, as they default to reasonable values.
# Only TLS-related options must be configured properly in usual setups.
# It is possible to use "include" keyword to import additional files
# e.g.: include "/etc/freeDiameter.d/*.conf"
# This is exactly equivalent as copy & paste the content of the included file(s)
# where the "include" keyword is found.
##############################################################
## Peer identity and realm
# The Diameter Identity of this daemon.
# This must be a valid FQDN that resolves to the local host.
# Default: hostname's FQDN
#Identity = "aaa.koganei.freediameter.net";
Identity = "smf.localdomain";
# The Diameter Realm of this daemon.
# Default: the domain part of Identity (after the first dot).
#Realm = "koganei.freediameter.net";
Realm = "localdomain";
##############################################################
## Transport protocol configuration
# The port this peer is listening on for incoming connections (TCP and SCTP).
# Default: 3868. Use 0 to disable.
#Port = 3868;
# The port this peer is listening on for incoming TLS-protected connections (TCP and SCTP).
# See TLS_old_method for more information about TLS flavours.
# Note: we use TLS/SCTP instead of DTLS/SCTP at the moment. This will change in future version of freeDiameter.
# Default: 5868. Use 0 to disable.
#SecPort = 5868;
# Use RFC3588 method for TLS protection, where TLS is negociated after CER/CEA exchange is completed
# on the unsecure connection. The alternative is RFC6733 mechanism, where TLS protects also the
# CER/CEA exchange on a dedicated secure port.
# This parameter only affects outgoing connections.
# The setting can be also defined per-peer (see Peers configuration section).
# Default: use RFC6733 method with separate port for TLS.
#TLS_old_method;
# Disable use of TCP protocol (only listen and connect over SCTP)
# Default : TCP enabled
#No_TCP;
# Disable use of SCTP protocol (only listen and connect over TCP)
# Default : SCTP enabled
#No_SCTP;
# This option is ignored if freeDiameter is compiled with DISABLE_SCTP option.
# Prefer TCP instead of SCTP for establishing new connections.
# This setting may be overwritten per peer in peer configuration blocs.
# Default : SCTP is attempted first.
#Prefer_TCP;
# Default number of streams per SCTP associations.
# This setting may be overwritten per peer basis.
# Default : 30 streams
#SCTP_streams = 30;
##############################################################
## Endpoint configuration
# Disable use of IP addresses (only IPv6)
# Default : IP enabled
#No_IP;
# Disable use of IPv6 addresses (only IP)
# Default : IPv6 enabled
#No_IPv6;
# Specify local addresses the server must bind to
# Default : listen on all addresses available.
#ListenOn = "202.249.37.5";
#ListenOn = "2001:200:903:2::202:1";
#ListenOn = "fe80::21c:5ff:fe98:7d62%eth0";
ListenOn = "127.0.0.4";
##############################################################
## Server configuration
# How many Diameter peers are allowed to be connecting at the same time ?
# This parameter limits the number of incoming connections from the time
# the connection is accepted until the first CER is received.
# Default: 5 unidentified clients in paralel.
#ThreadsPerServer = 5;
##############################################################
## TLS Configuration
# TLS is managed by the GNUTLS library in the freeDiameter daemon.
# You may find more information about parameters and special behaviors
# in the relevant documentation.
# http://www.gnu.org/software/gnutls/manual/
# Credentials of the local peer
# The X509 certificate and private key file to use for the local peer.
# The files must contain PKCS-1 encoded RSA key, in PEM format.
# (These parameters are passed to gnutls_certificate_set_x509_key_file function)
# Default : NO DEFAULT
#TLS_Cred = "<x509 certif file.PEM>" , "<x509 private key file.PEM>";
#TLS_Cred = "/etc/ssl/certs/freeDiameter.pem", "/etc/ssl/private/freeDiameter.key";
TLS_Cred = "/etc/freeDiameter/smf.cert.pem", "/etc/freeDiameter/smf.key.pem";
# Certificate authority / trust anchors
# The file containing the list of trusted Certificate Authorities (PEM list)
# (This parameter is passed to gnutls_certificate_set_x509_trust_file function)
# The directive can appear several times to specify several files.
# Default : GNUTLS default behavior
#TLS_CA = "<file.PEM>";
TLS_CA = "/etc/freeDiameter/cacert.pem";
# Certificate Revocation List file
# The information about revoked certificates.
# The file contains a list of trusted CRLs in PEM format. They should have been verified before.
# (This parameter is passed to gnutls_certificate_set_x509_crl_file function)
# Note: openssl CRL format might have interoperability issue with GNUTLS format.
# Default : GNUTLS default behavior
#TLS_CRL = "<file.PEM>";
# GNU TLS Priority string
# This string allows to configure the behavior of GNUTLS key exchanges
# algorithms. See gnutls_priority_init function documentation for information.
# You should also refer to the Diameter required TLS support here:
# http://tools.ietf.org/html/rfc6733#section-13.1
# Default : "NORMAL"
# Example: TLS_Prio = "NONE:+VERS-TLS1.1:+AES-128-CBC:+RSA:+SHA1:+COMP-NULL";
#TLS_Prio = "NORMAL";
# Diffie-Hellman parameters size
# Set the number of bits for generated DH parameters
# Valid value should be 768, 1024, 2048, 3072 or 4096.
# (This parameter is passed to gnutls_dh_params_generate2 function,
# it usually should match RSA key size)
# Default : 1024
#TLS_DH_Bits = 1024;
# Alternatively, you can specify a file to load the PKCS#3 encoded
# DH parameters directly from. This accelerates the daemon start
# but is slightly less secure. If this file is provided, the
# TLS_DH_Bits parameters has no effect.
# Default : no default.
#TLS_DH_File = "<file.PEM>";
##############################################################
## Timers configuration
# The Tc timer of this peer.
# It is the delay before a new attempt is made to reconnect a disconnected peer.
# The value is expressed in seconds. The recommended value is 30 seconds.
# Default: 30
#TcTimer = 30;
# The Tw timer of this peer.
# It is the delay before a watchdog message is sent, as described in RFC 3539.
# The value is expressed in seconds. The default value is 30 seconds. Value must
# be greater or equal to 6 seconds. See details in the RFC.
# Default: 30
#TwTimer = 30;
##############################################################
## Applications configuration
# Disable the relaying of Diameter messages?
# For messages not handled locally, the default behavior is to forward the
# message to another peer if any is available, according to the routing
# algorithms. In addition the "0xffffff" application is advertised in CER/CEA
# exchanges.
# Default: Relaying is enabled.
#NoRelay;
# Number of server threads that can handle incoming messages at the same time.
# Default: 4
#AppServThreads = 4;
# Other applications are configured by loaded extensions.
##############################################################
## Extensions configuration
# The freeDiameter framework merely provides support for
# Diameter Base Protocol. The specific application behaviors,
# as well as advanced functions, are provided
# by loadable extensions (plug-ins).
# These extensions may in addition receive the name of a
# configuration file, the format of which is extension-specific.
#
# Format:
#LoadExtension = "/path/to/extension" [ : "/optional/configuration/file" ] ;
#
# Examples:
#LoadExtension = "extensions/sample.fdx";
#LoadExtension = "extensions/sample.fdx":"conf/sample.conf";
# Extensions are named as follow:
# dict_* for extensions that add content to the dictionary definitions.
# dbg_* for extensions useful only to retrieve more information on the framework execution.
# acl_* : Access control list, to control which peers are allowed to connect.
# rt_* : routing extensions that impact how messages are forwarded to other peers.
# app_* : applications, these extensions usually register callbacks to handle specific messages.
# test_* : dummy extensions that are useful only in testing environments.
# The dbg_msg_dump.fdx extension allows you to tweak the way freeDiameter displays some
# information about some events. This extension does not actually use a configuration file
# but receives directly a parameter in the string passed to the extension. Here are some examples:
## LoadExtension = "dbg_msg_dumps.fdx" : "0x1111"; # Removes all default hooks, very quiet even in case of errors.
## LoadExtension = "dbg_msg_dumps.fdx" : "0x2222"; # Display all events with few details.
## LoadExtension = "dbg_msg_dumps.fdx" : "0x0080"; # Dump complete information about sent and received messages.
# The four digits respectively control: connections, routing decisions, sent/received messages, errors.
# The values for each digit are:
# 0 - default - keep the default behavior
# 1 - quiet - remove any specific log
# 2 - compact - display only a summary of the information
# 4 - full - display the complete information on a single long line
# 8 - tree - display the complete information in an easier to read format spanning several lines.
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dbg_msg_dumps.fdx" : "0x8888";
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_rfc5777.fdx";
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_mip6i.fdx";
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_nasreq.fdx";
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_nas_mipv6.fdx";
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_dcca.fdx";
LoadExtension = "/usr/lib/x86_64-linux-gnu/freeDiameter/dict_dcca_3gpp.fdx";
##############################################################
## Peers configuration
# The local server listens for incoming connections. By default,
# all unknown connecting peers are rejected. Extensions can override this behavior (e.g., acl_wl).
#
# In addition to incoming connections, the local peer can
# be configured to establish and maintain connections to some
# Diameter nodes and allow connections from these nodes.
# This is achieved with the ConnectPeer directive described below.
#
# Note that the configured Diameter Identity MUST match
# the information received inside CEA, or the connection will be aborted.
#
# Format:
#ConnectPeer = "diameterid" [ { parameter1; parameter2; ...} ] ;
# Parameters that can be specified in the peer's parameter list:
# No_TCP; No_SCTP; No_IP; No_IPv6; Prefer_TCP; TLS_old_method;
# No_TLS; # assume transparent security instead of TLS. DTLS is not supported yet (will change in future versions).
# Port = 5868; # The port to connect to
# TcTimer = 30;
# TwTimer = 30;
# ConnectTo = "202.249.37.5";
# ConnectTo = "2001:200:903:2::202:1";
# TLS_Prio = "NORMAL";
# Realm = "realm.net"; # Reject the peer if it does not advertise this realm.
# Examples:
#ConnectPeer = "aaa.wide.ad.jp";
#ConnectPeer = "old.diameter.serv" { TcTimer = 60; TLS_old_method; No_SCTP; Port=3868; } ;
ConnectPeer = "pcrf.localdomain" { ConnectTo = "127.0.0.9"; No_TLS; };
##############################################################
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-smf ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-smfd"]
CMD ["-c", "/etc/open5gs/smf.yaml"]

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: udm
description: A Helm chart for the Open5gs UDM
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-UDM" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-UDM" ) }}

View File

@ -0,0 +1,54 @@
{{- define "Deployment-UDM" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-UDM.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "udm" ) | nindent 8 }}
containers:
- name: udm
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "udm" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-udmd
args:
- -c
- /etc/open5gs/udm.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/udm.yaml
subPath: udm.yaml
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "udm.yaml" "udm" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "udm.yaml" "udm" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: udm.yaml
path: udm.yaml
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-UDM" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-UDM" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "udm.yaml" "udm" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-UDM" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,198 @@
images:
applications:
udm:
tag: latest
name: port/open5gs-udm
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
udm:
key: kubernetes.io/os
value: linux
config:
udm.yaml:
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,udm,event,tlv,mem,sock
#
logger:
file: /dev/stdout
level: debug
#
# udm:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: udm.key
# pem: udm.pem
#
# o SBI Server(https://127.0.0.12:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.12
# tls:
# key: udm.key
# pem: udm.pem
# - addr: ::1
#
# o SBI Server(http://udm.open5gs.org:80)
# sbi:
# name: udm.open5gs.org
#
# o SBI Server(http://127.0.0.12:7777)
# sbi:
# - addr: 127.0.0.12
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
udm:
sbi:
addr:
- 0.0.0.0
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%lo]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%lo
#
nrf:
sbi:
- name: nrf
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-udm ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-udmd"]
CMD ["-c", "/etc/open5gs/udm.yaml"]

View File

@ -0,0 +1,23 @@
apiVersion: v2
name: udr
description: A Helm chart for the Open5gs UDR
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

View File

@ -0,0 +1,14 @@
{{- define "ConfigMap-UDR" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
data:
{{- range $key, $value := .Values.config }}
{{- include "helpers.config.renderer" (dict "Global" $ "key" $key) | indent 2 }}
{{- end }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "ConfigMap-UDR" ) }}

View File

@ -0,0 +1,54 @@
{{- define "Deployment-UDR" -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
annotations:
scheduler.alpha.kubernetes.io/critical-pod: ''
spec:
replicas: 1
minReadySeconds: 30
strategy:
rollingUpdate:
maxUnavailable: 0
selector:
matchLabels: {{- include "helpers.labels.matchLabels" . | nindent 6 }}
template:
metadata:
labels: {{- include "helpers.labels.labels" . | nindent 8 }}
annotations:
checksum/config: {{ include "helpers.config.hash" ( dict "Global" $ "TemplateName" "ConfigMap-UDR.yaml" ) }}
spec:
nodeSelector:
{{ include "helpers.pod.node_selector" ( dict "Global" $ "Application" "udr" ) | nindent 8 }}
containers:
- name: udr
image: {{ include "helpers.pod.container.image" ( dict "Global" $ "Application" "udr" ) }}
imagePullPolicy: {{ .Values.images.pull.policy | quote }}
command:
- /usr/bin/open5gs-udrd
args:
- -c
- /etc/open5gs/udr.yaml
volumeMounts:
- name: config
mountPath: /etc/open5gs/udr.yaml
subPath: udr.yaml
livenessProbe:
tcpSocket:
port: {{ index $.Values.config "udr.yaml" "udr" "sbi" "port" }}
readinessProbe:
tcpSocket:
port: {{ index $.Values.config "udr.yaml" "udr" "sbi" "port" }}
volumes:
- name: config
configMap:
name: {{ template "helpers.labels.fullname" . }}
items:
- key: udr.yaml
path: udr.yaml
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Deployment-UDR" ) }}

View File

@ -0,0 +1,16 @@
{{- define "Service-UDR" -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "helpers.labels.fullname" . }}
labels: {{- include "helpers.labels.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: {{ index $.Values.config "udr.yaml" "udr" "sbi" "port" }}
protocol: TCP
selector: {{- include "helpers.labels.matchLabels" . | nindent 4 }}
...
{{- end -}}
{{- include "helpers.template.overlay" ( dict "Global" $ "template_definition" "Service-UDR" ) }}

View File

@ -0,0 +1,28 @@
{{- define "helpers.config.renderer" -}}
{{- $Global := index . "Global" -}}
{{- $key := index . "key" -}}
{{- $local := dict -}}
{{- $_ := set $local "templateRaw" ( index $Global.Values.config $key ) -}}
{{- with $Global -}}
{{- if not (kindIs "string" $local.templateRaw) -}}
{{- $_ := set $local "template" ( toString ( toPrettyJson ( $local.templateRaw ) ) ) -}}
{{- $_ := set $local "render" ( toString ( toYaml ( fromJson ( tpl $local.template . ) ) ) ) -}}
{{- else -}}
{{- $_ := set $local "template" $local.templateRaw -}}
{{- $_ := set $local "render" ( tpl $local.template . ) -}}
{{- end }}
{{ printf "%s: |" $key }}
{{ $local.render | indent 2 }}
{{- end -}}
{{- end -}}
{{- define "helpers.config.hash" -}}
{{- $name := index . "TemplateName" -}}
{{- $context := index . "Global" -}}
{{- $last := base $context.Template.Name }}
{{- $wtf := $context.Template.Name | replace $last $name -}}
{{- include $wtf $context | sha256sum | quote -}}
{{- end -}}

View File

@ -0,0 +1,49 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "helpers.labels.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "helpers.labels.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "helpers.labels.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Labels to use on {deploy|sts}.spec.selector.matchLabels and svc.spec.selector
*/}}
{{- define "helpers.labels.matchLabels" -}}
app.kubernetes.io/name: {{ include "helpers.labels.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "helpers.labels.labels" -}}
{{ include "helpers.labels.matchLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "helpers.labels.chart" . }}
{{- end -}}

View File

@ -0,0 +1,22 @@
{{- define "helpers.pod.container.image" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.images.applications $Application -}}
{{- printf "%s/%s:%s" .repo .name ( .tag | toString ) | quote -}}
{{- end -}}
{{- end -}}
{{- define "helpers.pod.node_selector" -}}
{{- $Global := index . "Global" -}}
{{- $Application := index . "Application" -}}
{{- with index $.Global.Values.node_labels $Application -}}
{{ if kindIs "slice" . }}
{{ range $k, $item := . }}
{{ $item.key }}: {{ $item.value | quote }}
{{ end }}
{{ else }}
{{ .key }}: {{ .value | quote }}
{{ end }}
{{- end }}
{{- end }}

View File

@ -0,0 +1,107 @@
{{- define "helpers.template.overlay" -}}
{{- $local := dict -}}
{{/*
By default we merge lists with a 'name' key's values
*/}}
{{- $_ := set $local "merge_same_named" true -}}
{{- if kindIs "map" $ -}}
{{- if hasKey $ "merge_same_named" -}}
{{- $_ := set $local "merge_same_named" $.merge_same_named -}}
{{- end -}}
{{- end -}}
{{- $_ := set $local "input" ( fromYaml ( toString ( include $.template_definition $.Global ) ) ) -}}
{{- $target := dict -}}
{{- $overlay_keys := regexSplit "-+" ( trimSuffix ".yaml" ( lower ( base $.Global.Template.Name ) ) ) 2 }}
{{- $_ := set $local "overlay" dict -}}
{{- if hasKey $.Global.Values.over_rides ( index $overlay_keys 0 ) -}}
{{- if hasKey ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ) ( index $overlay_keys 1 ) -}}
{{- $_ := set $local "overlay" ( index $.Global.Values.over_rides ( index $overlay_keys 0 ) ( index $overlay_keys 1 ) ) -}}
{{- end }}
{{- end }}
{{- range $item := tuple $local.input $local.overlay -}}
{{- $call := dict "target" $target "source" . "merge_same_named" $local.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- if kindIs "map" $ -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}
{{ $target | toYaml }}
{{- end -}}
{{- define "helpers._merge" -}}
{{- $local := dict -}}
{{- $_ := set $ "result" $.source -}}
{{/*
TODO: Should we `fail` when trying to merge a collection (map or slice) with
either a different kind of collection or a scalar?
*/}}
{{- if and (kindIs "map" $.target) (kindIs "map" $.source) -}}
{{- range $key, $sourceValue := $.source -}}
{{- if not (hasKey $.target $key) -}}
{{- $_ := set $local "newTargetValue" $sourceValue -}}
{{- if kindIs "map" $sourceValue -}}
{{- $copy := dict -}}
{{- $call := dict "target" $copy "source" $sourceValue -}}
{{- $_ := include "helpers._merge.shallow" $call -}}
{{- $_ := set $local "newTargetValue" $copy -}}
{{- end -}}
{{- else -}}
{{- $targetValue := index $.target $key -}}
{{- $call := dict "target" $targetValue "source" $sourceValue "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- $_ := set $local "newTargetValue" $call.result -}}
{{- end -}}
{{- $_ := set $.target $key $local.newTargetValue -}}
{{- end -}}
{{- $_ := set $ "result" $.target -}}
{{- else if and (kindIs "slice" $.target) (kindIs "slice" $.source) -}}
{{- $call := dict "target" $.target "source" $.source -}}
{{- $_ := include "helpers._merge.append_slice" $call -}}
{{- if $.merge_same_named -}}
{{- $_ := set $local "result" list -}}
{{- $_ := set $local "named_items" dict -}}
{{- range $item := $call.result -}}
{{- $_ := set $local "has_name_key" false -}}
{{- if kindIs "map" $item -}}
{{- if hasKey $item "name" -}}
{{- $_ := set $local "has_name_key" true -}}
{{- end -}}
{{- end -}}
{{- if $local.has_name_key -}}
{{- if hasKey $local.named_items $item.name -}}
{{- $named_item := index $local.named_items $item.name -}}
{{- $call := dict "target" $named_item "source" $item "merge_same_named" $.merge_same_named -}}
{{- $_ := include "helpers._merge" $call -}}
{{- else -}}
{{- $copy := dict -}}
{{- $copy_call := dict "target" $copy "source" $item -}}
{{- $_ := include "helpers._merge.shallow" $copy_call -}}
{{- $_ := set $local.named_items $item.name $copy -}}
{{- $_ := set $local "result" (append $local.result $copy) -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" (append $local.result $item) -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- $_ := set $local "result" $call.result -}}
{{- end -}}
{{- $_ := set $ "result" (uniq $local.result) -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.shallow" -}}
{{- range $key, $value := $.source -}}
{{- $_ := set $.target $key $value -}}
{{- end -}}
{{- end -}}
{{- define "helpers._merge.append_slice" -}}
{{- $local := dict -}}
{{- $_ := set $local "result" $.target -}}
{{- range $value := $.source -}}
{{- $_ := set $local "result" (append $local.result $value) -}}
{{- end -}}
{{- $_ := set $ "result" $local.result -}}
{{- end -}}

View File

@ -0,0 +1,208 @@
images:
applications:
udr:
tag: latest
name: port/open5gs-udr
repo: quay.io
pull:
policy: IfNotPresent
node_labels:
udr:
key: kubernetes.io/os
value: linux
config:
udr.yaml:
db_uri: mongodb://mongodb/open5gs
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,udr,event,tlv,mem,sock
#
logger:
file: /dev/stdout
level: debug
#
# udr:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: udr.key
# pem: udr.pem
#
# o SBI Server(https://127.0.0.20:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.20
# tls:
# key: udr.key
# pem: udr.pem
# - addr: ::1
#
# o SBI Server(http://udr.open5gs.org:80)
# sbi:
# name: udr.open5gs.org
#
# o SBI Server(http://127.0.0.20:7777)
# sbi:
# - addr: 127.0.0.20
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
udr:
sbi:
addr:
- 0.0.0.0
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%lo]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%lo
#
nrf:
sbi:
- name: nrf
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 8192 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 8192
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:
over_rides: {}

View File

@ -0,0 +1,22 @@
ARG FROM=ubuntu:focal
FROM $FROM
SHELL ["bash", "-exc"]
ARG DEBIAN_FRONTEND=noninteractive
# Update distro and install ansible
RUN apt-get update ;\
apt-get dist-upgrade -y ;\
apt-get install -y ;\
apt-get install -y --no-install-recommends \
software-properties-common ;\
add-apt-repository ppa:open5gs/latest ;\
apt-get update ;\
apt-get install -y --no-install-recommends \
open5gs-udr ;\
apt-get clean autoclean ;\
apt-get autoremove --yes ;\
rm -rf /var/lib/{apt,dpkg,cache,log}/
ENTRYPOINT ["/usr/bin/open5gs-udrd"]
CMD ["-c", "/etc/open5gs/udr.yaml"]

View File

@ -38,6 +38,29 @@
- ./tools/gate/jarvis/500-deploy-gerrit.sh
- ./tools/gate/jarvis/600-deploy-tekton.sh
- job:
name: airship-jarvis-sample-workload-validation
files:
- ^tools/gate/jarvis/5G-SA-core/.*$
- ^zuul\.d/.*$
timeout: 7200
pre-run:
- playbooks/airship-setup.yaml
run: playbooks/gate-runner.yaml
post-run: playbooks/gather-logs.yaml
description: Perform CI on the Jarvis Sample workload
nodeset: airship-charts-single-node
vars:
aio_params:
feature_gates: ""
collect_kubernetes_logs_namespace: tekton-pipelines
gate_scripts:
- ./tools/gate/jarvis/050-setup-development-ca.sh
- ./tools/gate/jarvis/100-deploy-k8s.sh
- ./tools/gate/jarvis/5G-SA-core/200-build-containers.sh
- ./tools/gate/jarvis/5G-SA-core/300-check-charts.sh
- ./tools/gate/jarvis/5G-SA-core/400-smoke-deployment.sh
- job:
name: airship-charts-upload-git-mirror
parent: upload-git-mirror

View File

@ -18,11 +18,13 @@
- ^doc/.*$
- airship-charts-lint-and-build
- airship-jarvis
- airship-jarvis-sample-workload-validation
gate:
jobs:
- openstack-tox-docs: *docs
- airship-charts-lint-and-build
- airship-jarvis
- airship-jarvis-sample-workload-validation
post:
jobs:
- airship-charts-upload-git-mirror