Commit 8fa37587 authored by arora's avatar arora 🎤 Committed by Raphael Defosseux
Browse files

Helm chart tutorial

- Added the tutorial for helm chart mini with gnb testing
- Update the helm charts
- Update photos in docker-compose tutorial
parent 81a0f261
This diff is collapsed.
#!/bin/bash
set -eo pipefail
#set -eo pipefail
STATUS=0
AMF_PORT_FOR_NGAP=38412
......
......@@ -12,4 +12,4 @@ kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-health-cm
data:
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 }}
\ No newline at end of file
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 | trim }}
\ No newline at end of file
......@@ -26,6 +26,10 @@ spec:
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
containers:
- name: tcpdump
image: "{{ .Values.tcpdumpimage.repository }}:{{ .Values.tcpdumpimage.version }}"
......@@ -75,7 +79,7 @@ spec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
initialDelaySeconds: 10
periodSeconds: 5
{{- end}}
ports:
......@@ -230,11 +234,6 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: smfFqdn0
- name: SELECTED_0
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: selected0
- name: SMF_INSTANCE_ID_1
valueFrom:
configMapKeyRef:
......@@ -255,11 +254,6 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: smfFqdn1
- name: SELECTED_1
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: selected1
- name: NRF_IPV4_ADDRESS
valueFrom:
configMapKeyRef:
......@@ -285,6 +279,11 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: ausfIpv4Addr
- name: AUSF_FQDN
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: ausfFqdn
- name: AUSF_PORT
valueFrom:
configMapKeyRef:
......@@ -295,11 +294,6 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: ausfApiVersion
- name: AUSF_FQDN
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: ausfFqdn
- name: NF_REGISTRATION
valueFrom:
configMapKeyRef:
......@@ -310,16 +304,16 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: smfSelection
- name: USE_FQDN_DNS
- name: EXTERNAL_AUSF
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: useFqdnDns
- name: EXTERNAL_AUSF
key: externalAusf
- name: USE_FQDN_DNS
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: externalAusf
key: useFqdnDns
- name: MYSQL_SERVER
valueFrom:
configMapKeyRef:
......@@ -363,4 +357,4 @@ spec:
{{- end }}
{{- if .Values.nodeName}}
nodeName: {{ .Values.nodeName }}
{{- end }}
{{- end }}
\ No newline at end of file
......@@ -8,7 +8,7 @@ spec:
config: '{
"cniVersion": "0.3.0",
"type": "macvlan",
"master": "bond0",
"master": {{- cat .Values.multus.hostInterface | nospace | quote }},
"mode": "bridge",
"ipam": {
"type": "static",
......
......@@ -5,10 +5,10 @@ replicaCount: 1
namespace: "oai"
nfimage:
nfimage: # image name either locally present or in a public/private repository
registry: local
repository: rdefosseoai/oai-amf # image name either locally present or in a public/private repository
version: v1.1.0 # image tag
repository: oai-amf ## dockerhub rdefosseoai/oai-amf
version: develop # image tag ### v1.1.0 develop for experimental features
# pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
......@@ -19,6 +19,9 @@ tcpdumpimage:
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
## good to use when pulling images from docker-hub mention
#imagePullSecrets:
# - name: "personalkey"
serviceAccount:
# Specifies whether a service account should be created
......@@ -54,6 +57,7 @@ multus:
n1IPadd: "192.168.18.177"
n1Netmask: "24"
n1Gateway: "192.168.18.129"
hostInterface: "bond0"
config:
instance: "0"
......@@ -72,9 +76,9 @@ config:
servedGuamiAmfSetId1: "1"
plmnSupportMcc: "208"
plmnSupportMnc: "95"
plmnSupportTac: "0xa000"
sst0: "222"
sd0: "123"
plmnSupportTac: "0x0001"
sst0: "1"
sd0: "1"
sst1: "111"
sd1: "124"
amfInterfaceNameForNGAP: "net1" # If multus creation is true then net1 else eth0
......@@ -82,25 +86,23 @@ config:
smfInstanceId0: "1" # Only configure if not using NRF
smfIpv4Addr0: "0.0.0.0" # Only configure if not using NRF
smfHttpVersion0: "v1" # Only configure if not using NRF
smfFqdn0: "oai-amf-svc" # Only configure if not using NRF
selected0: "true"
smfFqdn0: "localhost" # Only configure if not using NRF
smfInstanceId1: "2" # Currently disabled in the amf.conf no need to configure
smfIpv4Addr1: "0.0.0.0" # Currently disabled in the amf.conf no need to configure
smfHttpVersion1: "v1" # Currently disabled in the amf.conf no need to configure
smfFqdn1: "oai-amf-svc" # Currently disabled in the amf.conf no need to configure
selected1: "false"
smfFqdn1: "localhost" # Currently disabled in the amf.conf no need to configure
nrfIpv4Addr: "0.0.0.0"
nrfPort: 80
nrfApiVersion: "v1"
nrfFqdn: "oai-nrf-svc" # amf communicates using FQDN
ausfFqdn: "oai-ausf-svc"
externalAusf: "no"
ausfIpv4Addr: "127.0.0.1" # configure only if there is an external AUSF else it will communicate with mysql directly
ausfPort: 80
ausfApiVersion: "v1"
ausfFqdn: "oai-ausf-svc"
nfRegistration: "yes"
smfSelection: "yes"
useFqdnDns: "yes" # Important to avoid mentioning any static ip-address
externalAusf: "yes"
mySqlServer: "mysql" # used only if not using AUSF
mySqlUser: "root" # used only if not using AUSF
mySqlPass: "linux" # used only if not using AUSF
......
apiVersion: v1
name: oai-ausf
description: A Helm chart for AUSF network function
description: Helm chart for AUSF network function
type: application
icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png
version: 0.1.0
version: 1.1.2
appVersion: 0.1.0
appVersion: 1.1.2
keywords:
- 5GCN
......
#!/bin/bash
#set -eo pipefail
STATUS=0
SBI_INTERFACE=$(ifconfig $SBI_IF_NAME | grep inet | awk {'print $2'})
SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SBI_INTERFACE:$SBI_PORT")
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
NB_UNREPLACED_AT=`cat /openair-ausf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY configuration file is not configured properly"
fi
if [[ -z $SBI_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SBI_PORT is not listening."
fi
exit $STATUS
\ No newline at end of file
......@@ -6,4 +6,10 @@ data:
{{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }}
{{- end }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-health-cm
data:
{{ (.Files.Glob "scripts/live-ready.sh").AsConfig | indent 2 | trim }}
\ No newline at end of file
......@@ -15,16 +15,12 @@ spec:
metadata:
labels:
{{- include "oai-ausf.selectorLabels" . | nindent 8 }}
{{- if .Values.multus.create }}
annotations:
k8s.v1.cni.cncf.io/networks: {{ .Chart.Name }}-{{ .Values.namespace }}-net1
{{- end }}
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
containers:
- name: tcpdump
......@@ -58,6 +54,27 @@ spec:
{{- end}}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
volumeMounts:
- mountPath: /scripts
name: scripts
{{- if .Values.readinessProbe}}
readinessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 5
periodSeconds: 5
{{- end}}
{{- if .Values.livenessProbe}}
livenessProbe:
exec:
command:
- sh
- /scripts/live-ready.sh
initialDelaySeconds: 10
periodSeconds: 5
{{- end}}
ports:
- containerPort: {{ .Values.service.httpPort }}
name: http
......@@ -135,6 +152,9 @@ spec:
persistenceVolumeClaim:
claimName: cn5g-pvc
{{- end }}
- name: scripts
configMap:
name: {{ .Chart.Name }}-health-cm
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
......@@ -145,4 +165,4 @@ spec:
{{- end }}
{{- if .Values.nodeName}}
nodeName: {{ .Values.nodeName }}
{{- end }
{{- end }}
\ No newline at end of file
......@@ -8,8 +8,8 @@ namespace: "oai"
nfimage:
registry: local
repository: rdefosseoai/oai-ausf # image name either locally present or in a public/private repository
version: v1.1.0 # image tag
repository: oai-ausf ## rdefosseoai/oai-ausf # image name either locally present or in a public/private repository
version: develop ## latest/v1.2.0 tag for stable and develop for experimental
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
......@@ -20,7 +20,9 @@ tcpdumpimage:
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
imagePullSecrets: []
## good to use when pulling images from docker-hub mention
#imagePullSecrets:
# - name: "personalkey"
serviceAccount:
# Specifies whether a service account should be created
......@@ -46,12 +48,6 @@ start:
ausf: true
tcpdump: false #start tcpdump collection to analyse but beware it will take a lot of space in the container/persistent volume
multus:
create: false
n4IPadd: "192.168.101.131"
n4Netmask: "26"
n4Gw: "192.168.101.128"
config:
tz: "Europe/Paris"
instanceId: "0"
......@@ -60,13 +56,14 @@ config:
sbiIfName: "eth0"
sbiPort: "80"
useFqdnDns: "yes"
udmIpAddress: "192.168.101.130"
udmIpAddress: "127.0.0.1"
udmPort: "80"
udmVersionNb: "v1"
udmFqdn: "oai-udm-svc"
persistence:
sharedvolume: false
volumneName: managed-nfs-storage
size: 1Gi
resources:
......@@ -78,8 +75,12 @@ resources:
cpu: 100m
memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30
nodeSelector: {}
nodeName:
nodeName:
\ No newline at end of file
apiVersion: v1
name: oai-gnb
description: A Helm chart for gnb network function
# 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
icon: http://www.openairinterface.org/wp-content/uploads/2015/06/cropped-oai_final_logo.png
# 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.
version: 0.1.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: v1
keywords:
- RF Simulator
- gNB
- RAN
- 5G
sources:
- https://gitlab.eurecom.fr/oai/openairinterface5g
maintainers:
- name: OPENAIRINTERFACE
email: contact@openairinterface.org
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "oai-gnb.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "oai-gnb.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-gnb.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "oai-gnb.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "oai-gnb.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).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "oai-gnb.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 "oai-gnb.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "oai-gnb.labels" -}}
helm.sh/chart: {{ include "oai-gnb.chart" . }}
{{ include "oai-gnb.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "oai-gnb.selectorLabels" -}}
app.kubernetes.io/name: {{ include "oai-gnb.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "oai-gnb.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "oai-gnb.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Chart.Name }}-configmap
data:
{{- range $key, $val := .Values.config }}
{{ $key }}: {{ $val | quote }}
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
{{- include "oai-gnb.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "oai-gnb.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
{{- include "oai-gnb.selectorLabels" . | nindent 8 }}
app: 5grf-sim
{{- if .Values.multus.create }}
annotations:
k8s.v1.cni.cncf.io/networks: >-
[{
"name": "{{ .Chart.Name }}-{{ .Values.namespace }}-net1",
"default-route": ["{{ .Values.multus.gateway }}"]
}]
{{- end }}
spec:
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 8 }}
{{- end }}
containers:
- name: gnb
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
{{- if .Values.resources.define}}
resources:
requests:
memory: {{ .Values.resources.requests.memory | quote }}
cpu: {{ .Values.resources.requests.cpu | quote }}
limits:
memory: {{ .Values.resources.limits.memory | quote }}
cpu: {{ .Values.resources.limits.cpu | quote }}
{{- end}}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
ports:
- containerPort: {{ .Values.service.s1uPort }}
name: s1u
protocol: UDP
- containerPort: {{ .Values.service.s1cPort }}
name: s1c
protocol: UDP
- containerPort: {{ .Values.service.x2cPort }}
name: x2c
protocol: UDP
{{- if .Values.start.gnb}}
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
env:
- name: TZ
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: timeZone
- name: RFSIMULATOR
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: rfSimulator
- name: USE_SA_TDD_MONO
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: useSATddMono
- name: GNB_NAME
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: gnbName
- name: MCC
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: mcc
- name: MNC
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: mnc
- name: MNC_LENGTH
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: mncLength
- name: TAC
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: tac
- name: NSSAI_SST
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: nssaiSst
- name: NSSAI_SD0
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: nssaiSd0
- name: NSSAI_SD1
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: nssaiSd1
- name: AMF_IP_ADDRESS
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: amfIpAddress
- name: GNB_NGA_IF_NAME