From 986db77b88c7d02c66419a4c84e2f38e161f7d36 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 16 May 2025 14:18:18 +0200 Subject: [PATCH] CI: add helm charts for 4G and 5G OC deployments with ctest --- charts/physims-4g/Chart.yaml | 36 +++++++++++ .../physims-4g/charts/physims.4g/Chart.yaml | 35 +++++++++++ .../charts/physims.4g/templates/_helpers.tpl | 63 +++++++++++++++++++ .../charts/physims.4g/templates/job.yaml | 48 ++++++++++++++ .../physims-4g/charts/physims.4g/values.yaml | 48 ++++++++++++++ charts/physims-4g/templates/rbac.yaml | 26 ++++++++ .../physims-4g/templates/serviceaccount.yaml | 4 ++ charts/physims-4g/values.yaml | 21 +++++++ charts/physims-5g/Chart.yaml | 36 +++++++++++ .../physims-5g/charts/physims.5g/Chart.yaml | 35 +++++++++++ .../charts/physims.5g/templates/_helpers.tpl | 63 +++++++++++++++++++ .../charts/physims.5g/templates/job.yaml | 48 ++++++++++++++ .../physims-5g/charts/physims.5g/values.yaml | 48 ++++++++++++++ charts/physims-5g/templates/rbac.yaml | 26 ++++++++ .../physims-5g/templates/serviceaccount.yaml | 4 ++ charts/physims-5g/values.yaml | 21 +++++++ 16 files changed, 562 insertions(+) create mode 100644 charts/physims-4g/Chart.yaml create mode 100644 charts/physims-4g/charts/physims.4g/Chart.yaml create mode 100644 charts/physims-4g/charts/physims.4g/templates/_helpers.tpl create mode 100644 charts/physims-4g/charts/physims.4g/templates/job.yaml create mode 100644 charts/physims-4g/charts/physims.4g/values.yaml create mode 100644 charts/physims-4g/templates/rbac.yaml create mode 100644 charts/physims-4g/templates/serviceaccount.yaml create mode 100644 charts/physims-4g/values.yaml create mode 100644 charts/physims-5g/Chart.yaml create mode 100644 charts/physims-5g/charts/physims.5g/Chart.yaml create mode 100644 charts/physims-5g/charts/physims.5g/templates/_helpers.tpl create mode 100644 charts/physims-5g/charts/physims.5g/templates/job.yaml create mode 100644 charts/physims-5g/charts/physims.5g/values.yaml create mode 100644 charts/physims-5g/templates/rbac.yaml create mode 100644 charts/physims-5g/templates/serviceaccount.yaml create mode 100644 charts/physims-5g/values.yaml diff --git a/charts/physims-4g/Chart.yaml b/charts/physims-4g/Chart.yaml new file mode 100644 index 0000000000..0a6abe4caa --- /dev/null +++ b/charts/physims-4g/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-physim +description: A Helm chart for physical simulators 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: 1.0.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: v1 + +keywords: + - Physical Simulators + - RAN + - 4G + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims-4g/charts/physims.4g/Chart.yaml b/charts/physims-4g/charts/physims.4g/Chart.yaml new file mode 100644 index 0000000000..bd10179fc5 --- /dev/null +++ b/charts/physims-4g/charts/physims.4g/Chart.yaml @@ -0,0 +1,35 @@ +apiVersion: v1 +name: oai-physims-4g +description: A Helm subchart for 4G physims 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 + - RAN + - 4G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims-4g/charts/physims.4g/templates/_helpers.tpl b/charts/physims-4g/charts/physims.4g/templates/_helpers.tpl new file mode 100644 index 0000000000..2f6253d744 --- /dev/null +++ b/charts/physims-4g/charts/physims.4g/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-physims-4g.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-physims-4g.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-physims-4g.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-physims-4g.labels" -}} +helm.sh/chart: {{ include "oai-physims-4g.chart" . }} +{{ include "oai-physims-4g.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-physims-4g.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-physims-4g.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-physims-4g.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-physims-4g.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims-4g/charts/physims.4g/templates/job.yaml b/charts/physims-4g/charts/physims.4g/templates/job.yaml new file mode 100644 index 0000000000..03bf54a9ee --- /dev/null +++ b/charts/physims-4g/charts/physims.4g/templates/job.yaml @@ -0,0 +1,48 @@ +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 }} + {{- if .Values.global.resources.define}} + resources: + requests: + cpu: {{ .Values.global.resources.requests.cpu | quote }} + {{- end}} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + env: + - name: OPENAIR_DIR + value: /opt/oai-physim + command: ["/bin/sh", "-c"] + args: + - > + ctest -R 4g --show-only=json-v1 >> physims-4g-tests.json && + ctest -R 4g -j$(nproc) --output-junit physims-4g-run.xml --test-output-size-passed 100000 --test-output-size-failed 100000 ; + echo "FINISHED" && sleep 15 + 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}} + nodeName: {{ .Values.global.nodeName.physims5g }} + {{- end }} diff --git a/charts/physims-4g/charts/physims.4g/values.yaml b/charts/physims-4g/charts/physims.4g/values.yaml new file mode 100644 index 0000000000..52b751afd6 --- /dev/null +++ b/charts/physims-4g/charts/physims.4g/values.yaml @@ -0,0 +1,48 @@ +# Default values for oai-physims-4g +# 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-physims-4g" + +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-4g/templates/rbac.yaml b/charts/physims-4g/templates/rbac.yaml new file mode 100644 index 0000000000..989988baca --- /dev/null +++ b/charts/physims-4g/templates/rbac.yaml @@ -0,0 +1,26 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role +rules: +- apiGroups: + - security.openshift.io + resourceNames: + - anyuid + resources: + - securitycontextconstraints + verbs: + - use +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-binding +subjects: +- kind: ServiceAccount + name: {{ .Values.global.serviceAccountName }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role + apiGroup: rbac.authorization.k8s.io diff --git a/charts/physims-4g/templates/serviceaccount.yaml b/charts/physims-4g/templates/serviceaccount.yaml new file mode 100644 index 0000000000..0810702f4f --- /dev/null +++ b/charts/physims-4g/templates/serviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: oai-physim-sa #{{ .Values.global.serviceAccountName }} diff --git a/charts/physims-4g/values.yaml b/charts/physims-4g/values.yaml new file mode 100644 index 0000000000..ce9ff32c90 --- /dev/null +++ b/charts/physims-4g/values.yaml @@ -0,0 +1,21 @@ +# Default values for oai-physim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: + serviceAccountName: oai-physim-sa + namespace: "OAICICD_PROJECT" + image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-core-for-ci-ran/oai-physim + version: TAG + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + # removing the node selector + # will place on two nodes intel 3rd gen and 5th gen with RT kernel + nodeSelector: + type: ran + nodeName: '' + resources: + define: false + requests: + cpu: 1.5 diff --git a/charts/physims-5g/Chart.yaml b/charts/physims-5g/Chart.yaml new file mode 100644 index 0000000000..0a6abe4caa --- /dev/null +++ b/charts/physims-5g/Chart.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +name: oai-physim +description: A Helm chart for physical simulators 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: 1.0.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: v1 + +keywords: + - Physical Simulators + - RAN + - 4G + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims-5g/charts/physims.5g/Chart.yaml b/charts/physims-5g/charts/physims.5g/Chart.yaml new file mode 100644 index 0000000000..4da4ad2faa --- /dev/null +++ b/charts/physims-5g/charts/physims.5g/Chart.yaml @@ -0,0 +1,35 @@ +apiVersion: v1 +name: oai-physims-5g +description: A Helm subchart for 5G physims 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 + - RAN + - 5G + +sources: + - https://gitlab.eurecom.fr/oai/openairinterface5g + +maintainers: + - name: OPENAIRINTERFACE + email: contact@openairinterface.org diff --git a/charts/physims-5g/charts/physims.5g/templates/_helpers.tpl b/charts/physims-5g/charts/physims.5g/templates/_helpers.tpl new file mode 100644 index 0000000000..f18b616e58 --- /dev/null +++ b/charts/physims-5g/charts/physims.5g/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "oai-physims-5g.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-physims-5g.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-physims-5g.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "oai-physims-5g.labels" -}} +helm.sh/chart: {{ include "oai-physims-5g.chart" . }} +{{ include "oai-physims-5g.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "oai-physims-5g.selectorLabels" -}} +app.kubernetes.io/name: {{ include "oai-physims-5g.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "oai-physims-5g.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "oai-physims-5g.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/charts/physims-5g/charts/physims.5g/templates/job.yaml b/charts/physims-5g/charts/physims.5g/templates/job.yaml new file mode 100644 index 0000000000..7becb17f17 --- /dev/null +++ b/charts/physims-5g/charts/physims.5g/templates/job.yaml @@ -0,0 +1,48 @@ +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 }} + {{- if .Values.global.resources.define}} + resources: + requests: + cpu: {{ .Values.global.resources.requests.cpu | quote }} + {{- end}} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + env: + - name: OPENAIR_DIR + value: /opt/oai-physim + command: ["/bin/sh", "-c"] + args: + - > + ctest -R 5g --show-only=json-v1 >> physims-5g-tests.json && + ctest -R 5g -j$(nproc) --output-junit physims-5g-run.xml --test-output-size-passed 100000 --test-output-size-failed 100000 ; + echo "FINISHED" && sleep 20 + 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}} + nodeName: {{ .Values.global.nodeName.physims5g }} + {{- end }} diff --git a/charts/physims-5g/charts/physims.5g/values.yaml b/charts/physims-5g/charts/physims.5g/values.yaml new file mode 100644 index 0000000000..eb97064ebf --- /dev/null +++ b/charts/physims-5g/charts/physims.5g/values.yaml @@ -0,0 +1,48 @@ +# Default values for oai-physims-5g +# 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-physims-5g" + +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-5g/templates/rbac.yaml b/charts/physims-5g/templates/rbac.yaml new file mode 100644 index 0000000000..989988baca --- /dev/null +++ b/charts/physims-5g/templates/rbac.yaml @@ -0,0 +1,26 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role +rules: +- apiGroups: + - security.openshift.io + resourceNames: + - anyuid + resources: + - securitycontextconstraints + verbs: + - use +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-binding +subjects: +- kind: ServiceAccount + name: {{ .Values.global.serviceAccountName }} + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: {{ .Chart.Name }}-{{ .Release.Namespace }}-role + apiGroup: rbac.authorization.k8s.io diff --git a/charts/physims-5g/templates/serviceaccount.yaml b/charts/physims-5g/templates/serviceaccount.yaml new file mode 100644 index 0000000000..0810702f4f --- /dev/null +++ b/charts/physims-5g/templates/serviceaccount.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: oai-physim-sa #{{ .Values.global.serviceAccountName }} diff --git a/charts/physims-5g/values.yaml b/charts/physims-5g/values.yaml new file mode 100644 index 0000000000..ce9ff32c90 --- /dev/null +++ b/charts/physims-5g/values.yaml @@ -0,0 +1,21 @@ +# Default values for oai-physim. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +global: + serviceAccountName: oai-physim-sa + namespace: "OAICICD_PROJECT" + image: + registry: local + repository: image-registry.openshift-image-registry.svc:5000/oaicicd-core-for-ci-ran/oai-physim + version: TAG + # pullPolicy: IfNotPresent or Never or Always + pullPolicy: Always + # removing the node selector + # will place on two nodes intel 3rd gen and 5th gen with RT kernel + nodeSelector: + type: ran + nodeName: '' + resources: + define: false + requests: + cpu: 1.5