From f042bd7a2de35ee0ef77bfaf63e8f4d4521eed27 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 11 Apr 2024 16:04:38 +0200 Subject: [PATCH] Add psbchsim charts to test in physim CI tests --- charts/physims/charts/nr-psbchsim/Chart.yaml | 36 +++++++++++ .../charts/nr-psbchsim/templates/_helpers.tpl | 63 +++++++++++++++++++ .../charts/nr-psbchsim/templates/job.yaml | 42 +++++++++++++ charts/physims/charts/nr-psbchsim/values.yaml | 48 ++++++++++++++ charts/physims/values.yaml | 1 + ci-scripts/cls_physim1.py | 2 +- 6 files changed, 191 insertions(+), 1 deletion(-) create mode 100644 charts/physims/charts/nr-psbchsim/Chart.yaml create mode 100644 charts/physims/charts/nr-psbchsim/templates/_helpers.tpl create mode 100644 charts/physims/charts/nr-psbchsim/templates/job.yaml create mode 100644 charts/physims/charts/nr-psbchsim/values.yaml diff --git a/charts/physims/charts/nr-psbchsim/Chart.yaml b/charts/physims/charts/nr-psbchsim/Chart.yaml new file mode 100644 index 0000000000..8f1af6d648 --- /dev/null +++ b/charts/physims/charts/nr-psbchsim/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-nr-psbchsim +description: A Helm subchart for nr-psbchsim 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.1 + +# 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: v1 + +keywords: + - Physical Simulator + - nr-psbchsim + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims/charts/nr-psbchsim/templates/_helpers.tpl b/charts/physims/charts/nr-psbchsim/templates/_helpers.tpl new file mode 100644 index 0000000000..ef7fc150b5 --- /dev/null +++ b/charts/physims/charts/nr-psbchsim/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-nr-psbchsim.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-nr-psbchsim.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-nr-psbchsim.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-nr-psbchsim.labels" -}} +helm.sh/chart: {{ include "oai-nr-psbchsim.chart" . }} +{{ include "oai-nr-psbchsim.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-nr-psbchsim.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-nr-psbchsim.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-nr-psbchsim.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-nr-psbchsim.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims/charts/nr-psbchsim/templates/job.yaml b/charts/physims/charts/nr-psbchsim/templates/job.yaml new file mode 100644 index 0000000000..a302630d3b --- /dev/null +++ b/charts/physims/charts/nr-psbchsim/templates/job.yaml @@ -0,0 +1,42 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Chart.Name }} +spec: + template: + metadata: + labels: + app: physim + spec: + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: physim + image: "{{ .Values.global.image.repository }}:{{ .Values.global.image.version }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + env: + - name: OPENAIR_DIR + value: /opt/oai-physim + command: ["/bin/sh", "-c"] + args: + - > + cmake_targets/autotests/run_exec_autotests.bash -g "nr_psbchsim" -d bin/ && + echo "FINISHED" && sleep infinity + dnsPolicy: ClusterFirst + restartPolicy: Never + schedulerName: default-scheduler + serviceAccountName: {{ .Values.global.serviceAccountName }} + terminationGracePeriodSeconds: 30 + {{- if .Values.global.nodeSelector}} + nodeSelector: + {{- toYaml .Values.global.nodeSelector | nindent 12 }} + {{- end }} + {{- if .Values.global.nodeName.nrpsbchsim}} + nodeName: {{ .Values.global.nodeName.nrpsbchsim }} + {{- end }} diff --git a/charts/physims/charts/nr-psbchsim/values.yaml b/charts/physims/charts/nr-psbchsim/values.yaml new file mode 100644 index 0000000000..b6fa992ccf --- /dev/null +++ b/charts/physims/charts/nr-psbchsim/values.yaml @@ -0,0 +1,48 @@ +# Default values for oai-nr-psbchsim +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + +imagePullSecrets: [] + +nameOverride: "" +fullnameOverride: "" + +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-nr-psbchsim" + +podSecurityContext: + runAsUser: 0 + runAsGroup: 0 + +securityContext: + privileged: 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: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/physims/values.yaml b/charts/physims/values.yaml index bac4ed3eb5..82374001a2 100644 --- a/charts/physims/values.yaml +++ b/charts/physims/values.yaml @@ -27,6 +27,7 @@ global: nrpbschsim106rb: dedale nrpbchsim217rb: dedale nrpbchsim273rb: dedale + nrpsbchsim: dedale nrprachsim: dedale nrpucchsim: dedale nrulschsim: theseus diff --git a/ci-scripts/cls_physim1.py b/ci-scripts/cls_physim1.py index 70f8729764..85d8520a5f 100644 --- a/ci-scripts/cls_physim1.py +++ b/ci-scripts/cls_physim1.py @@ -166,7 +166,7 @@ class PhySim: mySSH.command('oc get pods -o wide -l app=physim | tee -a cmake_targets/log/physim_pods_summary.txt', '\$', 30, resync=True) running_count = mySSH.getBefore().count('Running') completed_count = mySSH.getBefore().count('Completed') - if (running_count + completed_count) == 21: + if (running_count + completed_count) == 22: logging.debug('\u001B[1m Running the physim test Scenarios\u001B[0m') isRunning = True podNames = re.findall('oai-[\S\d\w]+', mySSH.getBefore())