Commit 543a2de5 authored by ismail's avatar ismail
Browse files

CI: helm charts added for ausf, udm, udr


Signed-off-by: default avatarismail <mohammed.ismail@openairinterface.org>
parent 9baaae81
This diff is collapsed.
apiVersion: v1
name: oai-ausf
description: A Helm chart for AUSF 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.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.
appVersion: 0.1.0
keywords:
- Core Network
- 5G
- AUSF
sources:
- https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-ausf
- https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed
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-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: 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 }}
{{- 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 }}
{{- end }}
containers:
- name: tcpdump
image: image-registry.openshift-image-registry.svc:5000/oai/tcpdump-internal:latest
{{- 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}}
volumeMounts:
- mountPath: "/pcap"
name: cn5g-pv
- name: ausf
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
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
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: instance
- name: PID_DIRECTORY
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: 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: AMF_IP_ADDRESS
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: amfIpAddress
- name: AMF_PORT
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: amfPort
- name: AMF_VERSION_NB
valueFrom:
configMapKeyRef:
name: {{ .Chart.Name }}-configmap
key: amfVersionNb
{{- if .Values.start.ausf}}
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
volumes:
- name: cn5g-pv
persistentVolumeClaim:
claimName: cn5g-pvc
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
serviceAccountName: {{ .Values.serviceAccount.name }}
terminationGracePeriodSeconds: 15
---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: {{ .Chart.Name }}-{{ .Values.namespace }}-net1
spec:
config: '{
"cniVersion": "0.3.0",
"type": "macvlan",
"master": "bond0",
"mode": "bridge",
"ipam": {
"type": "static",
"addresses": [
{
"address": {{- cat .Values.multus.n4IPadd "/" .Values.multus.n4Netmask | nospace | quote }}
}
]
}
}'
\ 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:
- privileged
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: "PROJECT"
image:
registry: local
repository: image-registry.openshift-image-registry.svc:5000/PROJECT/oai-ausf
version: "TAG"
#pullPolicy: IfNotPresent or Never or Always
pullPolicy: Always
imagePullSecrets: []
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: true
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000
service:
type: ClusterIP
httpPort: 80
start:
ausf: true
tcpdump: true
multus:
create: true
n4IPadd: "192.168.101.131"
n4Netmask: "26"
n4Gw: "192.168.101.128"
config:
tz: "Europe/Paris"
instance: "0"
pidDirectory: "/var/run"
ausfName: "OAI_AUSF"
sbiIfName: "net1"
sbiPort: "80"
udmIpAddress: "192.168.101.130"
udmPort: "80"
udmVersionNb: "v1"
amfIpAddress: "192.168.18.177"
amfPort: "80"
amfVersionNb: "v1"
persistence:
# make it true for the first time when you want to create persistance volume
# and then false
enabled: false
resources:
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
#requests:
# cpu: 100m
# memory: 256Mi
tolerations: []
affinity: {}
apiVersion: v1
name: oai-udm
description: A Helm chart for UDM 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.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.
appVersion: 0.1.0
keywords:
- Core Network
- 5G
- UDM
sources:
- https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-udm
- https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed
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-udm.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-udm.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "oai-udm.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-udm.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-udm.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-udm.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-udm.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Common labels
*/}}
{{- define "oai-udm.labels" -}}
helm.sh/chart: {{ include "oai-udm.chart" . }}
{{ include "oai-udm.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}
{{/*
Selector labels
*/}}
{{- define "oai-udm.selectorLabels" -}}
app.kubernetes.io/name: {{ include "oai-udm.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
{{/*
Create the name of the service account to use
*/}}
{{- define "oai-udm.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "oai-udm.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-udm.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "oai-udm.selectorLabels" . | nindent 6 }}
strategy:
type: Recreate
template:
metadata:
labels:
{{- include "oai-udm.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 }}
{{- end }}
containers:
- name: tcpdump
image: image-registry.openshift-image-registry.svc:5000/oai/tcpdump-internal:latest
{{- if .Values.start.tcpdump}}
command:
- /bin/sh
- -c
- /usr/sbin/tcpdump -i any -w /pcap/oai-udm_`date +%Y-%m-%d_%H_%M-%S-%Z`.pcap
{{- else}}
command:
- /bin/sleep
- infinity
{{- end}}
volumeMounts:
- mountPath: "/pcap"
name: cn5g-pv
- name: udm
image: "{{ .Values.image.repository }}:{{ .Values.image.version }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
ports:
- containerPort: {{ .Values.service.httpPort }}
name: http
{{- if .Values.start.udm}}