Commit 55ffb1f6 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'new-tutorials' into 'master'

Updated the tutorials

See merge request oai/cn5g/oai-cn5g-fed!22
parents dea1951e 6918a149
......@@ -2,7 +2,6 @@ archives/
DS-TEST-RESULTS/
ci-scripts/mysql-complete.cmd
ci-scripts/temp/ci-*.sh
spgw_u.conf
deploy_results_oai_cn5g.html
ds_tester_results_oai_cn5g.html
cn5g_fed_docker_logs.zip
# RELEASE NOTES: #
## v1.2.0 -- September 2021 ##
* Incorporation of new public network functions:
- AUSF
- UDM
- UDR
* New tutorials with these new funtions
* CI improvements
## v1.1.0 -- July 2021 ##
* Improvements on Continuous Integration:
......
......@@ -38,6 +38,7 @@ Its main purpose is for Continuous Integration scripting.
It also hosts some tutorials.
* [How to do a container-based simple deployment](docs/DEPLOY_HOME.md).
* [How to create a container-based developer environment](docs/DEBUG_5G_CORE.md).
# Licence info
......
# mysql image version
## ref: https://hub.docker.com/r/library/mysql/tags/
##
image: "mysql-internal"
image: "mysql"
imageTag: "5.7.30"
strategy:
......
#!/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:
......@@ -275,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,6 +304,11 @@ spec:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: smfSelection
- name: EXTERNAL_AUSF
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: externalAusf
- name: USE_FQDN_DNS
valueFrom:
configMapKeyRef:
......
......@@ -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
......@@ -91,6 +95,8 @@ config:
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"
......
apiVersion: v1
name: oai-ausf
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: 1.1.2
appVersion: 1.1.2
keywords:
- 5GCN
- AUSF
sources:
- https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-ausf
maintainers:
- name: OPENAIRINTERFACE
email: contact@openairinterface.org
#!/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
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-ausf.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-ausf.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-ausf.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-ausf.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "oai-ausf.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-ausf.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-ausf.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "oai-ausf.labels" -}}
helm.sh/chart: {{ include "oai-ausf.chart" . }}
{{ include "oai-ausf.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "oai-ausf.selectorLabels" -}}
app.kubernetes.io/name: {{ include "oai-ausf.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "oai-ausf.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "oai-ausf.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: 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
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
labels:
{{- include "oai-ausf.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "oai-ausf.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
{{- include "oai-ausf.selectorLabels" . | nindent 8 }}
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 }}"
{{- if .Values.start.tcpdump}}
command:
- /bin/sh
- -c
- /usr/sbin/tcpdump -i any -w /pcap/oai-ausf_`date +%Y-%m-%d_%H_%M-%S-%Z`.pcap
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
{{- if .Values.persistence.sharedvolume}}
volumeMounts:
- mountPath: "/pcap"
name: cn5g-pv
{{- end}}
- name: ausf
image: "{{ .Values.nfimage.repository }}:{{ .Values.nfimage.version }}"
imagePullPolicy: {{ .Values.nfimage.pullPolicy }}
{{- 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 }}
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
{{- if .Values.start.ausf}}
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
env:
- name: TZ
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: tz
- name: INSTANCE_ID
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: instanceId
- name: PID_DIR
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: pidDirectory
- name: AUSF_NAME
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: ausfName
- name: SBI_IF_NAME
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: sbiIfName
- name: SBI_PORT
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: sbiPort
- name: USE_FQDN_DNS
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: useFqdnDns
- name: UDM_IP_ADDRESS
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: udmIpAddress
- name: UDM_PORT
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: udmPort
- name: UDM_VERSION_NB
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: udmVersionNb
- name: UDM_FQDN
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: udmFqdn
{{- if .Values.start.ausf}}
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
volumes:
{{- if .Values.persistence.sharedvolume}}
- name: cn5g-pv
persistenceVolumeClaim:
claimName: cn5g-pvc
{{- end }}
- name: scripts
configMap:
name: {{ .Chart.Name }}-health-cm
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
serviceAccountName: {{ .Values.serviceAccount.name }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
{{- if .Values.nodeSelector}}
nodeSelector: {{- toYaml .Values.nodeSelector | nindent 4 }}
{{- end }}
{{- if .Values.nodeName}}
nodeName: {{ .Values.nodeName }}
{{- end }}
\ No newline at end of file
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Chart.Name }}-{{ .Values.namespace }}-role
rules:
- apiGroups:
- security.openshift.io
resourceNames:
- anyuid
resources:
- securitycontextconstraints
verbs:
- use
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: {{ .Chart.Name }}-{{ .Values.namespace }}-binding
subjects:
- kind: ServiceAccount
name: {{ .Values.serviceAccount.name }}
namespace: {{ .Values.namespace }}
roleRef:
kind: Role
name: {{ .Chart.Name }}-{{ .Values.namespace }}-role
apiGroup: rbac.authorization.k8s.io
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-svc
labels:
{{- include "oai-ausf.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- name: http
# Port accessible outside cluster
port: {{ .Values.service.httpPort }}
# Port to forward to inside the pod
targetPort: {{ .Values.service.httpPort }}
protocol: TCP
selector:
{{- include "oai-ausf.selectorLabels" . | nindent 4 }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.serviceAccount.name }}
# Default values for oai-ausf.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
namespace: "oai"
nfimage:
registry: local
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
tcpdumpimage:
registry: local
repository: corfr/tcpdump
version: latest
#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
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: "oai-ausf-sa"
podSecurityContext:
runAsUser: 0
runAsGroup: 0
securityContext:
privileged: false
service:
type: ClusterIP
httpPort: 80
start:
ausf: true
tcpdump: false #start tcpdump collection to analyse but beware it will take a lot of space in the container/persistent volume
config:
tz: "Europe/Paris"
instanceId: "0"
pidDirectory: "/var/run"
ausfName: "OAI_AUSF"
sbiIfName: "eth0"
sbiPort: "80"
useFqdnDns: "yes"
udmIpAddress: "127.0.0.1"
udmPort: "80"
udmVersionNb: "v1"
udmFqdn: "oai-udm-svc"
persistence:
sharedvolume: false
volumneName: managed-nfs-storage
size: 1Gi
resources:
define: false
limits:
cpu: 100m
memory: 128Mi
requests:
cpu: 100m
memory: 256Mi
readinessProbe: true
livenessProbe: true
terminationGracePeriodSeconds: 30
nodeSelector: {}
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