initial sdcore-helm-charts update
Change-Id: I91788de083b0f906ce4b32ac226f616fb2647ef9
diff --git a/5g-ran-sim/Chart.yaml b/5g-ran-sim/Chart.yaml
new file mode 100644
index 0000000..d8ab119
--- /dev/null
+++ b/5g-ran-sim/Chart.yaml
@@ -0,0 +1,11 @@
+---
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+apiVersion: v1
+description: 5G RAN Simulator Service
+name: 5g-ran-sim
+icon: https://guide.opencord.org/logos/cord.svg
+
+version: 0.1.2
diff --git a/5g-ran-sim/templates/NOTES.txt b/5g-ran-sim/templates/NOTES.txt
new file mode 100644
index 0000000..fe31845
--- /dev/null
+++ b/5g-ran-sim/templates/NOTES.txt
@@ -0,0 +1,9 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+Notes - Instructions to use 5g ran simulator helm charts
diff --git a/5g-ran-sim/templates/_helpers.tpl b/5g-ran-sim/templates/_helpers.tpl
new file mode 100644
index 0000000..700d36c
--- /dev/null
+++ b/5g-ran-sim/templates/_helpers.tpl
@@ -0,0 +1,115 @@
+{{- /*
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+*/ -}}
+
+{{/*
+Renders a set of standardised labels
+*/}}
+{{- define "5g-ransim-plane.metadata_labels" -}}
+{{- $application := index . 0 -}}
+{{- $context := index . 1 -}}
+release: {{ $context.Release.Name }}
+app: {{ $application }}
+{{- end -}}
+
+{{/*
+Render the given template.
+*/}}
+{{- define "5g-ransim-plane.template" -}}
+{{- $name := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $last := base $context.Template.Name }}
+{{- $wtf := $context.Template.Name | replace $last $name -}}
+{{ include $wtf $context }}
+{{- end -}}
+
+{{/*
+Render ServiceAccount, Role, and RoleBinding required for kubernetes-entrypoint.
+*/}}
+{{- define "5g-ransim-plane.service_account" -}}
+{{- $context := index . 1 -}}
+{{- $saName := index . 0 -}}
+{{- $saNamespace := $context.Release.Namespace }}
+---
+apiVersion: v1
+kind: ServiceAccount
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+---
+{{- if semverCompare ">=1.16-0" $context.Capabilities.KubeVersion.GitVersion }}
+apiVersion: rbac.authorization.k8s.io/v1
+{{- else }}
+apiVersion: rbac.authorization.k8s.io/v1beta1
+{{- end }}
+kind: RoleBinding
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+roleRef:
+ apiGroup: rbac.authorization.k8s.io
+ kind: Role
+ name: {{ $saName }}
+subjects:
+ - kind: ServiceAccount
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+---
+{{- if semverCompare ">=1.16-0" $context.Capabilities.KubeVersion.GitVersion }}
+apiVersion: rbac.authorization.k8s.io/v1
+{{- else }}
+apiVersion: rbac.authorization.k8s.io/v1beta1
+{{- end }}
+kind: Role
+metadata:
+ name: {{ $saName }}
+ namespace: {{ $saNamespace }}
+ labels:
+{{ tuple $saName $context | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+rules:
+ - apiGroups:
+ - ""
+ - extensions
+ - batch
+ - apps
+ verbs:
+ - get
+ - list
+ - patch
+ resources:
+ - statefulsets
+ - daemonsets
+ - jobs
+ - pods
+ - services
+ - endpoints
+ - configmaps
+{{- end -}}
+
+{{/*
+Render init container for coredump.
+*/}}
+{{- define "5g-ransim-plane.coredump_init" -}}
+{{- $pod := index . 0 -}}
+{{- $context := index . 1 -}}
+- name: {{ $pod }}-coredump-init
+ image: {{ $context.Values.images.tags.init | quote }}
+ imagePullPolicy: {{ $context.Values.images.pullPolicy }}
+ securityContext:
+ privileged: true
+ runAsUser: 0
+ command: ["bash", "-xc"]
+ args:
+ - echo '/tmp/coredump/core.%h.%e.%t' > /mnt/host-rootfs/proc/sys/kernel/core_pattern
+ volumeMounts:
+ - name: host-rootfs
+ mountPath: /mnt/host-rootfs
+{{- end -}}
diff --git a/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl b/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl
new file mode 100644
index 0000000..42e47bc
--- /dev/null
+++ b/5g-ran-sim/templates/bin/_gnbsim-run.sh.tpl
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+set -xe
+
+{{- if .Values.config.coreDump.enabled }}
+cp /free5gc/amf/amf /tmp/coredump/
+{{- end }}
+
+#cat config files
+cd /free5gc
+cat ./config/gnb.conf
+cat /etc/hosts
+ip route add 192.168.252.0/24 via 192.168.251.1
+# Disabling checksum offloading to hardware
+ethtool -K enb tx off
+sleep infinity
diff --git a/5g-ran-sim/templates/configmap-gnbsim.yaml b/5g-ran-sim/templates/configmap-gnbsim.yaml
new file mode 100644
index 0000000..c7d5b14
--- /dev/null
+++ b/5g-ran-sim/templates/configmap-gnbsim.yaml
@@ -0,0 +1,22 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.config.gnbsim.deploy }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: gnbsim
+ labels:
+{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+data:
+ gnbsim-run.sh: |
+{{ tuple "bin/_gnbsim-run.sh.tpl" . | include "5g-ransim-plane.template" | indent 4 }}
+{{- range $key, $value := .Values.config.gnbsim.yamlCfgFiles }}
+ {{ $key }}: |
+{{ $value | indent 4 }}
+{{- end }}
+{{- end }}
diff --git a/5g-ran-sim/templates/networks.yaml b/5g-ran-sim/templates/networks.yaml
new file mode 100644
index 0000000..e716f03
--- /dev/null
+++ b/5g-ran-sim/templates/networks.yaml
@@ -0,0 +1,26 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+ # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+---
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+ name: enb-net
+{{- if $.Values.config.gnbsim.sriov.enabled }}
+ annotations:
+ k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio_access_net
+{{- end }}
+spec:
+ config: '{
+{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
+ "cniVersion": "0.3.1",
+{{- end }}
+ "type": {{ .Values.config.gnbsim.cniPlugin | quote }},
+ "ipam": {
+ "type": {{ .Values.config.gnbsim.ipam | quote }}
+ }
+ }'
+---
diff --git a/5g-ran-sim/templates/service-gnbsim.yaml b/5g-ran-sim/templates/service-gnbsim.yaml
new file mode 100644
index 0000000..003b625
--- /dev/null
+++ b/5g-ran-sim/templates/service-gnbsim.yaml
@@ -0,0 +1,23 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.config.gnbsim.deploy }}
+---
+apiVersion: v1
+kind: Service
+metadata:
+ name: gnbsim
+ labels:
+{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+spec:
+ type: ClusterIP
+ selector:
+{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+ ports:
+ - name: ngapp
+ port: {{ .Values.config.gnbsim.ngapp.port }}
+ protocol: SCTP
+{{- end }}
diff --git a/5g-ran-sim/templates/statefulset-gnbsim.yaml b/5g-ran-sim/templates/statefulset-gnbsim.yaml
new file mode 100644
index 0000000..d62293b
--- /dev/null
+++ b/5g-ran-sim/templates/statefulset-gnbsim.yaml
@@ -0,0 +1,109 @@
+{{/*
+# Copyright 2020-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+{{- if .Values.config.gnbsim.deploy }}
+{{ tuple "gnbsim" . | include "5g-ransim-plane.service_account" }}
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+ name: gnbsim
+ labels:
+{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 4 }}
+spec:
+ replicas: 1
+ serviceName: gnbsim-headless
+ selector:
+ matchLabels:
+{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 6 }}
+ template:
+ metadata:
+ labels:
+{{ tuple "gnbsim" . | include "5g-ransim-plane.metadata_labels" | indent 8 }}
+ annotations:
+ k8s.v1.cni.cncf.io/networks: '[
+ {
+ "name": "enb-net",
+ "interface": "enb",
+{{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.GitVersion }}
+ "ips": [{{ .Values.config.gnbsim.gnb.ip | quote }}]
+{{- else }}
+ "ips": {{ .Values.config.gnbsim.gnb.ip | quote }}
+{{- end }}
+ }
+ ]'
+ spec:
+ {{- if .Values.nodeSelectors.enabled }}
+ nodeSelector:
+ {{ .Values.nodeSelectors.gnbsim.label }}: {{ .Values.nodeSelectors.gnbsim.value }}
+ {{- end }}
+ serviceAccountName: gnbsim
+ {{- if hasKey .Values.images "pullSecrets" }}
+ imagePullSecrets:
+{{ toYaml .Values.images.pullSecrets | indent 8 }}
+ {{- end }}
+
+ initContainers:
+ - name: wait-amf-module
+ image: {{ .Values.images.tags.init | quote }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ command: ['sh', '-c', 'until nslookup amf; do echo waiting for nrf; sleep 4; done;']
+ {{- if .Values.config.coreDump.enabled }}
+{{ tuple "gnbsim" . | include "5g-ransim-plane.coredump_init" | indent 6 }}
+ {{- end }}
+ containers:
+ - name: gnbsim
+ image: {{ .Values.images.tags.gnbsim }}
+ imagePullPolicy: {{ .Values.images.pullPolicy }}
+ securityContext:
+ privileged: true
+ runAsUser: 0
+ stdin: true
+ tty: true
+ command: ["/opt/cp/scripts/gnbsim-run.sh"]
+ env:
+ - name: MEM_LIMIT
+ valueFrom:
+ resourceFieldRef:
+ containerName: gnbsim
+ resource: limits.memory
+ divisor: 1Mi
+ - name: POD_IP
+ valueFrom:
+ fieldRef:
+ fieldPath: status.podIP
+ {{- if .Values.resources.enabled }}
+ resources:
+{{ toYaml .Values.resources.gnbsim | indent 10 }}
+ {{- end }}
+ volumeMounts:
+ - name: cp-script
+ mountPath: /opt/cp/scripts/gnbsim-run.sh
+ subPath: gnbsim-run.sh
+ - name: cp-config
+ mountPath: /free5gc/config
+ {{- if .Values.config.coreDump.enabled }}
+ - name: coredump
+ mountPath: /tmp/coredump
+ {{- end }}
+ volumes:
+ - name: cp-script
+ configMap:
+ name: gnbsim
+ defaultMode: 493
+ - name: cp-config
+ configMap:
+ name: gnbsim
+ defaultMode: 420
+ {{- if .Values.config.coreDump.enabled }}
+ - name: host-rootfs
+ hostPath:
+ path: /
+ - name: coredump
+ hostPath:
+ path: {{ .Values.config.coreDump.path }}
+ {{- end }}
+{{- end }}
diff --git a/5g-ran-sim/values.yaml b/5g-ran-sim/values.yaml
new file mode 100644
index 0000000..42c61e5
--- /dev/null
+++ b/5g-ran-sim/values.yaml
@@ -0,0 +1,98 @@
+# Copyright 2020-present Open Networking Foundation
+#
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+
+images:
+ tags:
+ init: docker.io/omecproject/pod-init:1.0.0
+ gnbsim: registry.aetherproject.org/omecproject/5gc-gnbsim:dev-new-gnbsim-5f0cac4
+ depCheck: quay.io/stackanetes/kubernetes-entrypoint:v0.3.1
+ pullPolicy: IfNotPresent
+ # Secrets must be manually created in the namespace.
+ pullSecrets:
+ - name: aether.registry
+
+nodeSelectors:
+ enabled: false
+ gnbsim:
+ label: omec-cp
+ value: enabled
+
+resources:
+ enabled: true
+ gnbsim:
+ requests:
+ cpu: 2
+ memory: 1Gi
+ limits:
+ cpu: 2
+ memory: 1Gi
+
+config:
+ clusterDomain: cluster.local
+ coreDump:
+ enabled: false
+ path: /tmp/coredump
+ gnbsim:
+ deploy: true
+ sriov:
+ enabled: disabled
+ ipam: static
+ cniPlugin: simpleovs #need override value
+ gnb:
+ ip: 192.168.251.5/24
+ ngapp:
+ port: 38412
+ nodePort:
+ enabled: false
+ port: 30071
+ yamlCfgFiles:
+ gnb.conf: |
+ info:
+ version: 1.0.0
+ description: gNodeB sim initial configuration
+ configuration:
+ gnbs: # pool of gNodeBs
+ gnb1:
+ n2IpAddr: # gNB N2 interface IP address used to connect to AMF
+ n2Port: 9487 # gNB N2 Port used to connect to AMF
+ n3IpAddr: 192.168.251.5 # gNB N3 interface IP address used to connect to UPF
+ n3Port: 2152 # gNB N3 Port used to connect to UPF
+ name: gnb1 # gNB name that uniquely identify a gNB within application
+ gnbId: 000102 # gNB identifier (3 bytes hex string, range: 000000~FFFFFF)
+ tac: 000001 # Tracking Area Code (3 bytes hex string, range: 000000~FFFFFF)
+ defaultAmf:
+ hostName: amf # Host name of AMF
+ ipAddr: # AMF IP address
+ port: 38412 # AMF port
+ profiles: # profile information
+ - profileType: register # profile type
+ profileName: profile1 # uniqely identifies a profile within application
+ enable: false # Set true to execute the profile, false otherwise.
+ gnbName: gnb1 # gNB to be used for this profile
+ startImsi: 2089300007487 #First IMSI. Subsequent values will be used if ueCount is mo re than 1
+ ueCount: 5 # Number of UEs for for which the profile will be executed
+ plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
+ mcc: 208 # Mobile Country Code (3 digits string, digit: 0~9)
+ mnc: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
+ - profileType: pdusessest
+ profileName: profile2
+ enable: true
+ gnbName: gnb1
+ startImsi: 2089300007492
+ ueCount: 5
+ plmnId:
+ mcc: 208
+ mnc: 93
+ dataPktCount: 5 # Number of UL user data packets to be transmitted. Common for all UEs
+ - profileType: deregister
+ profileName: profile3
+ enable: false
+ gnbName: gnb1
+ startImsi: 2089300007497
+ ueCount: 5
+ plmnId:
+ mcc: 208
+ mnc: 93
+ logger:
+ logLevel: info # how detailed the log will be, values: trace, debug, info, warn, error, fatal, panic