From a3dc65f8b4748c7b01a247ac52da13d798e2f49e Mon Sep 17 00:00:00 2001 From: Carlos Giraldo Date: Tue, 14 Jun 2022 15:01:51 +0200 Subject: [PATCH] split gnb - ues deployments in ueransim-gnb --- charts/ueransim-gnb/Chart.yaml | 4 +- charts/ueransim-gnb/templates/NOTES.txt | 4 +- charts/ueransim-gnb/templates/_helpers.tpl | 4 +- .../templates/gnb-deployment.yaml | 33 ++------- .../templates/ues-deployment.yaml | 69 +++++++++++++++++++ charts/ueransim-gnb/values.yaml | 64 ++++++----------- 6 files changed, 101 insertions(+), 77 deletions(-) create mode 100644 charts/ueransim-gnb/templates/ues-deployment.yaml diff --git a/charts/ueransim-gnb/Chart.yaml b/charts/ueransim-gnb/Chart.yaml index d3c9bb8fc..ea29a90a4 100644 --- a/charts/ueransim-gnb/Chart.yaml +++ b/charts/ueransim-gnb/Chart.yaml @@ -8,7 +8,7 @@ dependencies: tags: - bitnami-common version: 1.x.x -description: ueransim for 5G RAN simulation +description: ueransim gNodeB for 5G RAN simulation engine: gotpl home: https://github.com/aligungr/UERANSIM icon: https://github.com/aligungr/UERANSIM/raw/master/.github/logo.png @@ -24,4 +24,4 @@ maintainers: name: ueransim-gnb sources: - https://github.com/aligungr/UERANSIM -version: 0.1.0 +version: 0.2.0 diff --git a/charts/ueransim-gnb/templates/NOTES.txt b/charts/ueransim-gnb/templates/NOTES.txt index f09f13160..c4aa09785 100644 --- a/charts/ueransim-gnb/templates/NOTES.txt +++ b/charts/ueransim-gnb/templates/NOTES.txt @@ -3,7 +3,7 @@ ueransim-gnb successfully installed! Check gnodeb log with: ``` -kubectl -n {{ .Release.Namespace }} logs svc/{{ include "common.names.fullname" . }} -c gnodeb +kubectl -n {{ .Release.Namespace }} logs deployment/{{ include "common.names.fullname" . }} ``` --- @@ -13,7 +13,7 @@ kubectl -n {{ .Release.Namespace }} logs svc/{{ include "common.names.fullname" You have also deployed {{ .Values.ues.count }} ues. You can enter ues terminal with: ``` -kubectl -n {{ .Release.Namespace }} exec -ti svc/{{ include "common.names.fullname" . }} -c ues -- /bin/bash +kubectl -n {{ .Release.Namespace }} exec -ti deployment/{{ include "common.names.fullname" . }}-ues -- /bin/bash ``` There is a tun interface for each ue. You can bind your application to the interface to test ue connectivity. diff --git a/charts/ueransim-gnb/templates/_helpers.tpl b/charts/ueransim-gnb/templates/_helpers.tpl index 439d9ce2c..09331706c 100644 --- a/charts/ueransim-gnb/templates/_helpers.tpl +++ b/charts/ueransim-gnb/templates/_helpers.tpl @@ -2,13 +2,13 @@ {{/* Return the proper ueransim image name */}} -{{- define "ueransim-gnb.image" -}} +{{- 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-gnb.imagePullSecrets" -}} +{{- 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-gnb/templates/gnb-deployment.yaml b/charts/ueransim-gnb/templates/gnb-deployment.yaml index d21c4c308..0e3d4d846 100644 --- a/charts/ueransim-gnb/templates/gnb-deployment.yaml +++ b/charts/ueransim-gnb/templates/gnb-deployment.yaml @@ -4,6 +4,7 @@ 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 }} @@ -13,17 +14,19 @@ metadata: spec: selector: matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }} + app.kubernetes.io/component: gnb 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-gnb.imagePullSecrets" . | nindent 6 }} + {{- include "ueransim.imagePullSecrets" . | nindent 6 }} {{- if .Values.affinity }} affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }} {{- end }} @@ -38,7 +41,7 @@ spec: {{- end }} containers: - name: gnodeb - image: {{ template "ueransim-gnb.image" . }} + image: {{ template "ueransim.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.containerSecurityContext.enabled }} securityContext: {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }} @@ -66,7 +69,6 @@ spec: value: {{ .Values.interfaces.n3.dev }} - name: RADIO_IFACE value: {{ .Values.interfaces.radio.dev }} - {{- if .Values.resources }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- end }} @@ -74,31 +76,6 @@ spec: - name: config mountPath: /etc/ueransim/gnb.yaml subPath: "gnb.yaml" - {{- if .Values.ues.enabled }} - - name: ues - image: {{ template "ueransim-gnb.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy }} - securityContext: - privileged: true - capabilities: - add: ["NET_ADMIN"] - args: - - ue - - -n - - {{ .Values.ues.count | quote }} - env: - - name: GNB_IP - valueFrom: - fieldRef: - fieldPath: status.podIP - {{- if .Values.resources }} - resources: {{- toYaml .Values.resources | nindent 12 }} - {{- end }} - volumeMounts: - - name: config-ues - mountPath: /etc/ueransim/ue.yaml - subPath: "ue.yaml" - {{- end }} volumes: - name: config configMap: diff --git a/charts/ueransim-gnb/templates/ues-deployment.yaml b/charts/ueransim-gnb/templates/ues-deployment.yaml new file mode 100644 index 000000000..4ba8d89c7 --- /dev/null +++ b/charts/ueransim-gnb/templates/ues-deployment.yaml @@ -0,0 +1,69 @@ +{{- if .Values.ues.enabled }} +apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "common.names.fullname" . }}-ues + namespace: {{ .Release.Namespace | quote }} + labels: {{- include "common.labels.standard" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + app.kubernetes.io/component: ues + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + selector: + matchLabels: {{ include "common.labels.matchLabels" . | nindent 6 }} + app.kubernetes.io/component: ues + template: + metadata: + {{- if .Values.ues.podAnnotations }} + annotations: {{- include "common.tplvalues.render" (dict "value" .Values.ues.podAnnotations "context" $) | nindent 8 }} + {{- end }} + labels: {{- include "common.labels.standard" . | nindent 8 }} + {{- if .Values.ues.podLabels }} + {{- include "common.tplvalues.render" (dict "value" .Values.ues.podLabels "context" $) | nindent 8 }} + {{- end }} + app.kubernetes.io/component: ues + spec: + {{- include "ueransim.imagePullSecrets" . | nindent 6 }} + {{- if .Values.ues.affinity }} + affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.ues.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.ues.nodeSelector }} + nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.ues.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.ues.tolerations }} + tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.ues.tolerations "context" .) | nindent 8 }} + {{- end }} + {{- if .Values.ues.podSecurityContext.enabled }} + securityContext: {{- omit .Values.ues.podSecurityContext "enabled" | toYaml | nindent 8 }} + {{- end }} + containers: + - name: ues + image: {{ template "ueransim.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + privileged: true + capabilities: + add: ["NET_ADMIN"] + env: + - name: GNB_HOSTNAME + value: {{ template "common.names.fullname" . }} + args: + - ue + - -n + - {{ .Values.ues.count | quote }} + {{- if .Values.ues.resources }} + resources: {{- toYaml .Values.ues.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: /etc/ueransim/ue.yaml + subPath: "ue.yaml" + volumes: + - name: config + configMap: + name: {{ include "common.names.fullname" . }}-ues +{{- end }} \ No newline at end of file diff --git a/charts/ueransim-gnb/values.yaml b/charts/ueransim-gnb/values.yaml index 4e969fd1c..e3eb2ce15 100644 --- a/charts/ueransim-gnb/values.yaml +++ b/charts/ueransim-gnb/values.yaml @@ -78,59 +78,37 @@ mnc: '70' sst: 1 sd: "0xffffff" tac: '0001' -ues: - enabled: true - count: 4 - initialMSISDN: '0000000001' - key: 465B5CE8B199B49FAA5F0A2EE238A6BC - op: E8ED289DEBA952E4283B54E88E6183CA - opType: OPC - apn: internet -## 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: [] + +ues: + enabled: false + count: 1 + initialMSISDN: '0000000001' + key: 465B5CE8B199B49FAA5F0A2EE238A6BC + op: E8ED289DEBA952E4283B54E88E6183CA + opType: OPC + apn: internet + resources: + limits: {} + requests: {} + podSecurityContext: + enabled: false + containerSecurityContext: + enabled: false + podLabels: {} + podAnnotations: {} + affinity: {} + nodeSelector: {} + tolerations: []