From 7796ee6ea49fe1098f9511873a00c1faadaeba91 Mon Sep 17 00:00:00 2001 From: "Fuss, Areli (af732p)" Date: Thu, 18 Jun 2020 14:31:30 +0300 Subject: [PATCH] [RIC-435] DevOps: Create Simulator on K8S Signed-off-by: Fuss, Areli (af732p) Change-Id: I7d486e22e8e9c507d6ca69ebf525755e012ba908 --- tools/gnbe2-oran-simu/.helmignore | 22 +++++++++ tools/gnbe2-oran-simu/Chart.yaml | 5 +++ tools/gnbe2-oran-simu/requirements.lock | 6 +++ tools/gnbe2-oran-simu/requirements.yaml | 21 +++++++++ tools/gnbe2-oran-simu/templates/_helpers.tpl | 32 ++++++++++++++ tools/gnbe2-oran-simu/templates/deployment.yaml | 59 +++++++++++++++++++++++++ tools/gnbe2-oran-simu/templates/service.yaml | 19 ++++++++ tools/gnbe2-oran-simu/values.yaml | 39 ++++++++++++++++ 8 files changed, 203 insertions(+) create mode 100644 tools/gnbe2-oran-simu/.helmignore create mode 100644 tools/gnbe2-oran-simu/Chart.yaml create mode 100644 tools/gnbe2-oran-simu/requirements.lock create mode 100644 tools/gnbe2-oran-simu/requirements.yaml create mode 100644 tools/gnbe2-oran-simu/templates/_helpers.tpl create mode 100644 tools/gnbe2-oran-simu/templates/deployment.yaml create mode 100644 tools/gnbe2-oran-simu/templates/service.yaml create mode 100644 tools/gnbe2-oran-simu/values.yaml diff --git a/tools/gnbe2-oran-simu/.helmignore b/tools/gnbe2-oran-simu/.helmignore new file mode 100644 index 0000000..50af031 --- /dev/null +++ b/tools/gnbe2-oran-simu/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/tools/gnbe2-oran-simu/Chart.yaml b/tools/gnbe2-oran-simu/Chart.yaml new file mode 100644 index 0000000..864db12 --- /dev/null +++ b/tools/gnbe2-oran-simu/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: gnbe2-oran-simu +version: 0.1.0 diff --git a/tools/gnbe2-oran-simu/requirements.lock b/tools/gnbe2-oran-simu/requirements.lock new file mode 100644 index 0000000..09f6004 --- /dev/null +++ b/tools/gnbe2-oran-simu/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: ric-common + repository: http://127.0.0.1:8879/charts + version: 3.3.2 +digest: sha256:1a1b80af7610e8da957e547cdcca89b0a81b2cdeae0856d3a87c27dcad5db3c2 +generated: 2020-06-17T21:27:41.027430677Z diff --git a/tools/gnbe2-oran-simu/requirements.yaml b/tools/gnbe2-oran-simu/requirements.yaml new file mode 100644 index 0000000..ba6a220 --- /dev/null +++ b/tools/gnbe2-oran-simu/requirements.yaml @@ -0,0 +1,21 @@ +################################################################################ +# Copyright (c) 2019 AT&T Intellectual Property. # +# Copyright (c) 2019 Nokia. # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); # +# you may not use this file except in compliance with the License. # +# You may obtain a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +################################################################################ + +dependencies: + - name: ric-common + version: ^3.1.0 + repository: "@local" diff --git a/tools/gnbe2-oran-simu/templates/_helpers.tpl b/tools/gnbe2-oran-simu/templates/_helpers.tpl new file mode 100644 index 0000000..2d5dd72 --- /dev/null +++ b/tools/gnbe2-oran-simu/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "gnbe2-oran-simu.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 "gnbe2-oran-simu.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 "gnbe2-oran-simu.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/tools/gnbe2-oran-simu/templates/deployment.yaml b/tools/gnbe2-oran-simu/templates/deployment.yaml new file mode 100644 index 0000000..2164641 --- /dev/null +++ b/tools/gnbe2-oran-simu/templates/deployment.yaml @@ -0,0 +1,59 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "gnbe2-oran-simu.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "gnbe2-oran-simu.name" . }} + helm.sh/chart: {{ include "gnbe2-oran-simu.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "gnbe2-oran-simu.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "gnbe2-oran-simu.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + hostNetwork: true + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.registry }}/{{ .Values.image.name }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} +# livenessProbe: +# tcpSocket: +# port: {{ .Values.service.internalPort }} +# readinessProbe: +# tcpSocket: +# port: {{ .Values.service.internalPort }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + env: + - name: gNBipv4 + value: 0.0.0.0 + - name: gNBport + value: "{{ .Values.service.internalPort }}" + - name: ricIpv4 + value: $(SERVICE_RICPLT_E2TERM_SCTP_ALPHA_SERVICE_HOST) + - name: ricPort + value: $(SERVICE_RICPLT_E2TERM_SCTP_ALPHA_SERVICE_PORT) + - name: nbue + value: "0" + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/tools/gnbe2-oran-simu/templates/service.yaml b/tools/gnbe2-oran-simu/templates/service.yaml new file mode 100644 index 0000000..a017192 --- /dev/null +++ b/tools/gnbe2-oran-simu/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "gnbe2-oran-simu.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "gnbe2-oran-simu.name" . }} + helm.sh/chart: {{ include "gnbe2-oran-simu.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.internalPort }} + targetPort: sctp + protocol: SCTP + name: sctp + selector: + app.kubernetes.io/name: {{ include "gnbe2-oran-simu.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/tools/gnbe2-oran-simu/values.yaml b/tools/gnbe2-oran-simu/values.yaml new file mode 100644 index 0000000..24a64d0 --- /dev/null +++ b/tools/gnbe2-oran-simu/values.yaml @@ -0,0 +1,39 @@ +# Default values for gnbe2-oran-simu. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +imagePullPolicy: IfNotPresent +image: + name: gnbe2_oran_simu + tag: 3.2-32 + registry: "snapshot.docker.ranco-dev-tools.eastus.cloudapp.azure.com:10001" + +nameOverride: "" +fullnameOverride: "" + +service: + type: NodePort + nodePort: "32212" + internalPort: 5577 + externalPort: 5577 + + +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: {} -- 2.16.6