From 0ec2c1db17fb6b3a53f7876901434f9df1cc9c15 Mon Sep 17 00:00:00 2001 From: Carlos Giraldo Date: Wed, 21 Jul 2021 11:18:23 +0200 Subject: [PATCH 1/2] initial commit --- charts/ueransim/Chart.yaml | 25 ++++ charts/ueransim/README.md | 69 +++++++++++ charts/ueransim/resources/gnb.yaml | 23 ++++ charts/ueransim/resources/ue.yaml | 73 +++++++++++ charts/ueransim/templates/_helpers.tpl | 14 +++ charts/ueransim/templates/configmap.yaml | 19 +++ charts/ueransim/templates/statefulset.yaml | 88 ++++++++++++++ charts/ueransim/values.yaml | 134 +++++++++++++++++++++ 8 files changed, 445 insertions(+) create mode 100644 charts/ueransim/Chart.yaml create mode 100644 charts/ueransim/README.md create mode 100644 charts/ueransim/resources/gnb.yaml create mode 100644 charts/ueransim/resources/ue.yaml create mode 100644 charts/ueransim/templates/_helpers.tpl create mode 100644 charts/ueransim/templates/configmap.yaml create mode 100644 charts/ueransim/templates/statefulset.yaml create mode 100644 charts/ueransim/values.yaml diff --git a/charts/ueransim/Chart.yaml b/charts/ueransim/Chart.yaml new file mode 100644 index 000000000..3973de71f --- /dev/null +++ b/charts/ueransim/Chart.yaml @@ -0,0 +1,25 @@ +annotations: + category: apps +apiVersion: v2 +appVersion: 3.2.2 +dependencies: + - name: common + repository: https://charts.bitnami.com/bitnami + tags: + - bitnami-common + version: 1.x.x +description: ueransim for 5G RAN simulation +engine: gotpl +home: https://github.com/aligungr/UERANSIM +icon: https://github.com/aligungr/UERANSIM/raw/master/.github/logo.png +keywords: + - apps + - gradiant + - k8s +maintainers: + - email: cgiraldo@gradiant.org + name: cgiraldo +name: ueransim +sources: + - https://github.com/aligungr/UERANSIM +version: 0.1.0 diff --git a/charts/ueransim/README.md b/charts/ueransim/README.md new file mode 100644 index 000000000..ead477534 --- /dev/null +++ b/charts/ueransim/README.md @@ -0,0 +1,69 @@ +# ueransim + +![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![AppVersion: 3.2.2](https://img.shields.io/badge/AppVersion-3.2.2-informational?style=flat-square) + +ueransim for 5G RAN simulation + +**Homepage:** + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| Gradiant | admin@gradiant.org | | + +## Source Code + +* + +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | common | 1.x.x | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| UECount | int | `4` | | +| affinity | object | `{}` | | +| amf | string | `"open5gs-amf"` | | +| apn | string | `"internet"` | | +| clusterDomain | string | `"cluster.local"` | | +| commonAnnotations | object | `{}` | | +| commonLabels | object | `{}` | | +| containerSecurityContext.enabled | bool | `false` | | +| extraDeploy | list | `[]` | | +| fullnameOverride | string | `nil` | | +| global.imagePullSecrets | list | `[]` | | +| global.imageRegistry | string | `nil` | | +| global.storageClass | string | `nil` | | +| image.debug | bool | `false` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.pullSecrets | list | `[]` | | +| image.registry | string | `"docker.io"` | | +| image.repository | string | `"openverso/ueransim"` | | +| image.tag | string | `"3.2.2"` | | +| initialMSISDN | string | `"0000000001"` | | +| key | string | `"465B5CE8B199B49FAA5F0A2EE238A6BC"` | | +| kubeVersion | string | `nil` | | +| mcc | string | `"901"` | | +| mnc | string | `"70"` | | +| nameOverride | string | `nil` | | +| nodeSelector | object | `{}` | | +| op | string | `"E8ED289DEBA952E4283B54E88E6183CA"` | | +| opType | string | `"OPC"` | | +| podAnnotations | object | `{}` | | +| podLabels | object | `{}` | | +| podSecurityContext.enabled | bool | `false` | | +| resources.limits | object | `{}` | | +| resources.requests | object | `{}` | | +| sd | int | `1` | | +| sst | int | `1` | | +| tac | string | `"0001"` | | +| tolerations | list | `[]` | | +| updateStrategy.type | string | `"RollingUpdate"` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) diff --git a/charts/ueransim/resources/gnb.yaml b/charts/ueransim/resources/gnb.yaml new file mode 100644 index 000000000..09bfc5c3f --- /dev/null +++ b/charts/ueransim/resources/gnb.yaml @@ -0,0 +1,23 @@ +mcc: {{ .Values.mcc }} # Mobile Country Code value +mnc: {{ .Values.mnc }} # Mobile Network Code value (2 or 3 digits) + +nci: '0x0000000100' # NR Cell Identity (36-bit) +idLength: 32 # NR gNB ID length in bits [22...32] +tac: {{ .Values.tac }} # Tracking Area Code + +linkIp: 127.0.0.1 # gNB's local IP address for Radio Link Simulation (Usually same with local IP) +ngapIp: 0.0.0.0 # gNB's local IP address for N2 Interface (Usually same with local IP) +gtpIp: 0.0.0.0 # gNB's local IP address for N3 Interface (Usually same with local IP) + +# List of AMF address information +amfConfigs: + - address: ${AMF_ADDR} + port: 38412 + +# List of supported S-NSSAIs by this gNB +slices: + - sst: {{ .Values.sst }} + sd: {{ .Values.sd }} + +# Indicates whether or not SCTP stream number errors should be ignored. +ignoreStreamIds: true \ No newline at end of file diff --git a/charts/ueransim/resources/ue.yaml b/charts/ueransim/resources/ue.yaml new file mode 100644 index 000000000..6ea6d9538 --- /dev/null +++ b/charts/ueransim/resources/ue.yaml @@ -0,0 +1,73 @@ +# IMSI number of the UE. IMSI = [MCC|MNC|MSISDN] (In total 15 or 16 digits) +supi: 'imsi-{{ .Values.mcc }}{{ .Values.mnc }}{{ .Values.initialMSISDN }}' +# Mobile Country Code value +mcc: {{ .Values.mcc }} +# Mobile Network Code value (2 or 3 digits) +mnc: {{ .Values.mnc }} + +# Permanent subscription key +key: '{{ .Values.key }}' +# Operator code (OP or OPC) of the UE +op: '{{ .Values.op }}' +# This value specifies the OP type and it can be either 'OP' or 'OPC' +opType: '{{ .Values.opType }}' +# Authentication Management Field (AMF) value +amf: '8000' +# IMEI number of the device. It is used if no SUPI is provided +imei: '356938035643803' +# IMEISV number of the device. It is used if no SUPI and IMEI is provided +imeiSv: '4370816125816151' + +# List of gNB IP addresses for Radio Link Simulation +gnbSearchList: + - 127.0.0.1 + + # UAC Access Identities Configuration +uacAic: + mps: false + mcs: false + +# UAC Access Control Class +uacAcc: + normalClass: 0 + class11: false + class12: false + class13: false + class14: false + class15: false + +# Initial PDU sessions to be established +sessions: + - type: 'IPv4' + apn: {{ .Values.apn }} + slice: + sst: {{ .Values.sst }} + sd: {{ .Values.sd }} + emergency: false + +# Configured NSSAI for this UE by HPLMN +configured-nssai: + - sst: {{ .Values.sst }} + sd: {{ .Values.sd }} + +# Default Configured NSSAI for this UE +default-nssai: + - sst: {{ .Values.sst }} + sd: {{ .Values.sd }} + +# Supported encryption algorithms by this UE +integrity: + IA1: true + IA2: true + IA3: true + +# Supported integrity algorithms by this UE +ciphering: + EA1: true + EA2: true + EA3: true + +# Integrity protection maximum data rate for user plane +integrityMaxRate: + uplink: 'full' + downlink: 'full' diff --git a/charts/ueransim/templates/_helpers.tpl b/charts/ueransim/templates/_helpers.tpl new file mode 100644 index 000000000..09331706c --- /dev/null +++ b/charts/ueransim/templates/_helpers.tpl @@ -0,0 +1,14 @@ + +{{/* +Return the proper ueransim image name +*/}} +{{- define "ueransim.image" -}} +{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "ueransim.imagePullSecrets" -}} +{{- include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) -}} +{{- end -}} \ No newline at end of file diff --git a/charts/ueransim/templates/configmap.yaml b/charts/ueransim/templates/configmap.yaml new file mode 100644 index 000000000..0d3c7c8ec --- /dev/null +++ b/charts/ueransim/templates/configmap.yaml @@ -0,0 +1,19 @@ + +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: gnb + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +data: + gnb.yaml: | +{{ tpl (.Files.Get "resources/gnb.yaml") . | indent 4 }} + ue.yaml: | +{{ tpl (.Files.Get "resources/ue.yaml") . | indent 4 }} \ No newline at end of file diff --git a/charts/ueransim/templates/statefulset.yaml b/charts/ueransim/templates/statefulset.yaml new file mode 100644 index 000000000..5af2c293e --- /dev/null +++ b/charts/ueransim/templates/statefulset.yaml @@ -0,0 +1,88 @@ + +apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }} +kind: StatefulSet +metadata: + name: {{ template "common.names.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: gnb + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + replicas: 1 + selector: + matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }} + app.kubernetes.io/component: gnb + serviceName: {{ template "common.names.fullname" . }} + {{- if .Values.updateStrategy }} + updateStrategy: {{- toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + template: + metadata: + {{- if .Values.podAnnotations }} + annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + app.kubernetes.io/component: gnb + {{- if .Values.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + spec: + {{- include "ueransim.imagePullSecrets" . | nindent 6 }} + {{- if .Values.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.podSecurityContext.enabled }} + securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + containers: + - name: gnodeb + image: {{ template "ueransim.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.containerSecurityContext.enabled }} + securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} + {{- end }} + args: + - gnb + env: + - name: AMF_HOSTNAME + value: {{ .Values.amf }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /etc/ueransim/gnb.yaml + subPath: "gnb.yaml" + - name: ues + image: {{ template "ueransim.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + privileged: true + capabilities: + add: ["NET_ADMIN"] + args: + - ue + - -n + - {{ .Values.UECount }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /etc/ueransim/ue.yaml + subPath: "ue.yaml" + volumes: + - name: config + configMap: + name: {{ include "common.names.fullname" . }} \ No newline at end of file diff --git a/charts/ueransim/values.yaml b/charts/ueransim/values.yaml new file mode 100644 index 000000000..b1bc9467d --- /dev/null +++ b/charts/ueransim/values.yaml @@ -0,0 +1,134 @@ +## @section Global parameters +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry, imagePullSecrets and storageClass + +## @param global.imageRegistry Global Docker image registry +## @param global.imagePullSecrets Global Docker registry secret names as an array +## @param global.storageClass Global StorageClass for Persistent Volume(s) +## +global: + imageRegistry: + ## E.g. + ## imagePullSecrets: + ## - myRegistryKeySecretName + ## + imagePullSecrets: [] + storageClass: + +## @section Common parameters + +## @param kubeVersion Override Kubernetes version +## +kubeVersion: +## @param nameOverride String to partially override common.names.fullname +## +nameOverride: +## @param fullnameOverride String to fully override common.names.fullname +## +fullnameOverride: +## @param commonLabels Labels to add to all deployed objects +## +commonLabels: {} +## @param commonAnnotations Annotations to add to all deployed objects +## +commonAnnotations: {} +## @param clusterDomain Kubernetes cluster domain name +## +clusterDomain: cluster.local +## @param extraDeploy Array of extra objects to deploy with the release +## +extraDeploy: [] + +image: + registry: docker.io + repository: openverso/ueransim + tag: 3.2.2 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## e.g: + ## pullSecrets: + ## - myRegistryKeySecretName + ## + pullSecrets: [] + ## Enable debug mode + ## + debug: false + + +mcc: '901' +mnc: '70' +tac: '0001' + +UECount: 4 +initialMSISDN: '0000000001' +key: 465B5CE8B199B49FAA5F0A2EE238A6BC +op: E8ED289DEBA952E4283B54E88E6183CA +opType: OPC +apn: internet +sst: 1 +sd: 1 + +amf: open5gs-amf + +## resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## resources.limits the resources limits for the containers +## resources.requests the requested resources for the containers +## +resources: + limits: {} + requests: {} +## Configure Pods Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## @param podsecuritycontext.enabled enabled pods' Security Context +## @param podsecuritycontext.fsgroup set pod's Security Context fsGroup +## +podSecurityContext: + enabled: false +# fsGroup: 1001 +## Configure Container Security Context +## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod +## @param containersecuritycontext.enabled enabled containers' Security Context +## @param containersecuritycontext.runasuser set containers' Security Context runAsUser +## +containerSecurityContext: + enabled: false +# runAsUser: 1001 + +## @param podlabels extra labels for pods +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} +## @param podannotations annotations for pods +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} + +## @param .affinity affinity for pods assignment +## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## NOTE: `podaffinitypreset`, and `nodeAffinityPreset` will be ignored when it's set +## +affinity: {} +## @param nodeselector node labels for pods assignment +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## @param tolerations tolerations pods assignment +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] +## @param updatestrategy.type statefulset strategy type +## ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies +## +updateStrategy: + ## StrategyType + ## Can be set to RollingUpdate or OnDelete + ## + type: RollingUpdate From 32477369edd367550557d54585b30e0e49031735 Mon Sep 17 00:00:00 2001 From: Carlos Giraldo Date: Wed, 21 Jul 2021 15:07:56 +0200 Subject: [PATCH 2/2] fix type error in args --- charts/ueransim/templates/statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/ueransim/templates/statefulset.yaml b/charts/ueransim/templates/statefulset.yaml index 5af2c293e..a7c4c37f8 100644 --- a/charts/ueransim/templates/statefulset.yaml +++ b/charts/ueransim/templates/statefulset.yaml @@ -74,7 +74,7 @@ spec: args: - ue - -n - - {{ .Values.UECount }} + - {{ .Values.UECount | quote }} {{- if .Values.resources }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- end }}