From f3d492808ef3408b811d08fb7eaf26eccf83b031 Mon Sep 17 00:00:00 2001 From: Tommy Carpenter Date: Mon, 10 Jun 2019 10:00:38 -0400 Subject: [PATCH] Add a1 helm chart Signed-off-by: Tommy Carpenter Change-Id: Id4530fabc695be05b665edd0c7bee8b15e53804e Signed-off-by: Tommy Carpenter --- ric-platform/50-RIC-Platform/bin/install | 2 +- ric-platform/50-RIC-Platform/bin/uninstall | 2 +- .../50-RIC-Platform/helm/a1mediator/.gitignore | 1 + .../50-RIC-Platform/helm/a1mediator/.helmignore | 22 +++++++ .../50-RIC-Platform/helm/a1mediator/Chart.yaml | 4 ++ .../helm/a1mediator/files/ricmanifest.json | 67 ++++++++++++++++++++++ .../a1mediator/files/rmr_string_int_mapping.txt | 2 + .../helm/a1mediator/templates/_helpers.tpl | 45 +++++++++++++++ .../helm/a1mediator/templates/config.yaml | 12 ++++ .../helm/a1mediator/templates/deployment.yaml | 60 +++++++++++++++++++ .../helm/a1mediator/templates/service.yaml | 56 ++++++++++++++++++ .../templates/tests/test-connection.yaml | 15 +++++ .../50-RIC-Platform/helm/a1mediator/values.yaml | 32 +++++++++++ .../50-RIC-Platform/helm/ingress-appmgr.yaml | 13 +++++ .../50-RIC-Platform/helm/ingress-appmgr.yaml~ | 13 +++++ .../50-RIC-Platform/helm/ingress-e2mgr.yaml | 13 +++++ .../50-RIC-Platform/helm/ingress-e2mgr.yaml~ | 13 +++++ ric-platform/50-RIC-Platform/helm/ingress.yaml | 17 ++++++ ric-platform/50-RIC-Platform/helm/ingress.yaml~ | 17 ++++++ 19 files changed, 404 insertions(+), 2 deletions(-) create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml~ create mode 100644 ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml~ create mode 100644 ric-platform/50-RIC-Platform/helm/ingress.yaml create mode 100644 ric-platform/50-RIC-Platform/helm/ingress.yaml~ diff --git a/ric-platform/50-RIC-Platform/bin/install b/ric-platform/50-RIC-Platform/bin/install index 53023f3c..4c97c14a 100755 --- a/ric-platform/50-RIC-Platform/bin/install +++ b/ric-platform/50-RIC-Platform/bin/install @@ -37,7 +37,7 @@ else fi -RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term" +RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator" echo "Deploying RIC Platform components [$RICPLT_COMPONENTS]" echo "Platform Namespace: $NAMESPACE" diff --git a/ric-platform/50-RIC-Platform/bin/uninstall b/ric-platform/50-RIC-Platform/bin/uninstall index b5937b1d..e5a65fa5 100755 --- a/ric-platform/50-RIC-Platform/bin/uninstall +++ b/ric-platform/50-RIC-Platform/bin/uninstall @@ -36,7 +36,7 @@ else fi -RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term" +RICPLT_COMPONENTS="appmgr rtmgr dbaas e2mgr e2term a1mediator" echo "Undeploying RIC Platform components [$RICPLT_COMPONENTS]" echo "Platform Namespace: $NAMESPACE" diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore b/ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore new file mode 100644 index 00000000..d8651e0c --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore @@ -0,0 +1 @@ +NOTES.txt diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore b/ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/.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/ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml new file mode 100644 index 00000000..be6cc65f --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A1 Helm chart for Kubernetes +name: a1mediator +version: 1.0.0 diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json b/ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json new file mode 100644 index 00000000..0fb5f09b --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json @@ -0,0 +1,67 @@ +{ + "controls":[ + { + "name":"admission_control_policy", + "description":"various parameters to control admission of dual connection", + "message_receives_rmr_type":"DC_ADMISSION_INTERVAL_CONTROL", + "message_receives_payload_schema":{ + "$schema":"http://json-schema.org/draft-07/schema#", + "type":"object", + "properties":{ + "enforce":{ + "type":"boolean", + "default":true + }, + "window_length":{ + "type":"integer", + "default":1, + "minimum":1, + "maximum":60, + "description":"Sliding window length (in minutes)" + }, + "blocking_rate":{ + "type":"number", + "default":10, + "minimum":1, + "maximum":100, + "description":"% Connections to block" + }, + "trigger_threshold":{ + "type":"integer", + "default":10, + "minimum":1, + "description":"Minimum number of events in window to trigger blocking" + } + }, + "required":[ + "enforce", + "blocking_rate", + "trigger_threshold", + "window_length" + ], + "additionalProperties":false + }, + "message_sends_rmr_type":"DC_ADMISSION_INTERVAL_CONTROL_ACK", + "message_sends_payload_schema":{ + "$schema":"http://json-schema.org/draft-07/schema#", + "type":"object", + "properties":{ + "status":{ + "type":"string", + "enum":[ + "SUCCESS", + "FAIL" + ] + }, + "message":{ + "type":"string" + } + }, + "required":[ + "status" + ], + "additionalProperties":false + } + } + ] +} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt b/ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt new file mode 100644 index 00000000..f2804adb --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt @@ -0,0 +1,2 @@ +DC_ADMISSION_INTERVAL_CONTROL:20000 +DC_ADMISSION_INTERVAL_CONTROL_ACK:20001 diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl new file mode 100644 index 00000000..fa46babd --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl @@ -0,0 +1,45 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "a1mediator.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 "a1mediator.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 "a1mediator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "a1mediator.labels" -}} +app.kubernetes.io/name: {{ include "a1mediator.name" . }} +helm.sh/chart: {{ include "a1mediator.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml new file mode 100644 index 00000000..afac492b --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: a1conf +data: + local.rt: | + newrt|start + rte|20000|ADM_CONTROL_GOES_HERE:4563 + rte|20001|{{ .Values.rmrservice.name }}:{{ .Values.rmrservice.port }} + newrt|end + rmr_string_int_mapping.txt: {{ tpl (.Files.Get "files/rmr_string_int_mapping.txt") . | quote }} + ricmanifest.json: {{ tpl (.Files.Get "files/ricmanifest.json") . | quote }} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml new file mode 100644 index 00000000..7669af84 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "a1mediator.fullname" . }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + imagePullSecrets: + - name: {{ include "common.repositoryCred" . }} + containers: + - name: {{ include "common.namespace" . }}-{{ include "common.name" . }} + volumeMounts: + - name: a1conf + mountPath: /opt/ricmanifest.json + subPath: ricmanifest.json + - name: a1conf + mountPath: /opt/rmr_string_int_mapping.txt + subPath: rmr_string_int_mapping.txt + - name: a1conf + mountPath: /opt/route/local.rt + subPath: local.rt + env: + - name: PYTHONUNBUFFERED + value: "0" + - name: RMR_RCV_RETRY_INTERVAL + value: "{{ .Values.rmr_timeout_config.rcv_retry_interval_ms }}" + - name: RMR_RETRY_TIMES + value: "{{ .Values.rmr_timeout_config.rcv_retry_times }}" + image: {{ include "common.repository" . }}/{{ .Values.a1mediator.image.name }}:{{ .Values.a1mediator.image.tag }} + imagePullPolicy: {{ include "common.pullPolicy" . }} + ports: + - name: http + containerPort: {{ .Values.httpservice.port }} + protocol: TCP + + livenessProbe: + httpGet: + path: /ui + port: http + readinessProbe: + httpGet: + path: /ui + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: "a1conf" + configMap: + name: "a1conf" diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml new file mode 100644 index 00000000..3321aa61 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml @@ -0,0 +1,56 @@ +# This is the service for A1's external facing HTTP API +apiVersion: v1 +kind: Service +metadata: + name: {{ include "a1mediator.fullname" . }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} + +spec: + type: {{ .Values.httpservice.type }} + ports: + - port: {{ .Values.httpservice.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + +--- +# This is the service for rmr between A1 and the xapps +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.rmrservice.name }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} + +spec: + type: {{ .Values.rmrservice.type }} + ports: + - port: {{ .Values.rmrservice.port }} + targetPort: {{ .Values.rmrservice.port }} + protocol: TCP + selector: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + +--- +# This is the service for the "hidden" port 4561 that rmr listens on for route manager +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.rmrrtemgrservice.name }} + labels: +{{ include "a1mediator.labels" . | indent 4 }} + +spec: + type: {{ .Values.rmrrtemgrservice.type }} + ports: + - port: {{ .Values.rmrrtemgrservice.port }} + targetPort: {{ .Values.rmrrtemgrservice.port }} + protocol: TCP + selector: + app.kubernetes.io/name: {{ include "a1mediator.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml new file mode 100644 index 00000000..ca683685 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "a1mediator.fullname" . }}-test-connection" + labels: +{{ include "a1mediator.labels" . | indent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "a1mediator.fullname" . }}:{{ .Values.httpservice.port }}'] + restartPolicy: Never diff --git a/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml b/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml new file mode 100644 index 00000000..d6aed57a --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml @@ -0,0 +1,32 @@ +a1mediator: + replicaCount: 1 + + image: + repository: nexus3.o-ran-sc.org:10004 + name: ric-plt-a1 + tag: 0.8.2 + pullPolicy: IfNotPresent + + +# This is the service for A1's external facing HTTP API +httpservice: + port: 10000 # This is hardcoded in a1, probably dangerous to change + type: ClusterIP + +# This is the service for rmr between A1 and the xapps +rmrservice: + name: rmrservice + port: 4562 # This is hardcoded in a1, probably dangerous to change + type: ClusterIP + +# This is the service for the "hidden" port 4561 that rmr listens on for route manager +rmrrtemgrservice: + name: rmrrtemgrservice + port: 4561 # This is hardcoded in rmr, probably dangerous to change + type: ClusterIP + +# these are ENV variables that A1 takes; see docs +rmr_timeout_config: + rcv_retry_interval_ms: 500 + rcv_retry_times: 20 + diff --git a/ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml b/ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml new file mode 100644 index 00000000..ff890f2c --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml @@ -0,0 +1,13 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress-appmgr +spec: + rules: + - host: foo.bar.com + http: + paths: + - path: /appmgr + backend: + serviceName: r0-appmgr + servicePort: 8080 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml~ b/ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml~ new file mode 100644 index 00000000..ad0203bf --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml~ @@ -0,0 +1,13 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress +spec: + rules: + - host: foo.bar.com + http: + paths: + - path: /appmgr + backend: + serviceName: r0-appmgr + servicePort: 8080 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml b/ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml new file mode 100644 index 00000000..a4cb379c --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml @@ -0,0 +1,13 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress-e2mgr +spec: + rules: + - host: foo.bar.com + http: + paths: + - path: /e2mgr + backend: + serviceName: r0-e2mgr + servicePort: 3800 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml~ b/ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml~ new file mode 100644 index 00000000..3083a15c --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml~ @@ -0,0 +1,13 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress +spec: + rules: + - host: foo.bar.com + http: + paths: + - path: /e2mgr + backend: + serviceName: r0-e2mgr + servicePort: 3800 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/ingress.yaml b/ric-platform/50-RIC-Platform/helm/ingress.yaml new file mode 100644 index 00000000..10474311 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/ingress.yaml @@ -0,0 +1,17 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress +spec: + rules: + - host: foo.bar.com + http: + paths: + - path: /e2mgr + backend: + serviceName: r0-e2mgr + servicePort: 3800 + - path: /appmgr + backend: + serviceName: r0-appmgr + servicePort: 8080 \ No newline at end of file diff --git a/ric-platform/50-RIC-Platform/helm/ingress.yaml~ b/ric-platform/50-RIC-Platform/helm/ingress.yaml~ new file mode 100644 index 00000000..91ba4eb0 --- /dev/null +++ b/ric-platform/50-RIC-Platform/helm/ingress.yaml~ @@ -0,0 +1,17 @@ +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: ric-ingress +spec: + rules: + - host: foo.bar.com + http: + paths: + - path: /e2mgr + backend: + serviceName: r0-e2mgr + servicePort: 3800 + - path: /appmgr + backend: + serviceName: r0-appmgr + servicePort: 8080 \ No newline at end of file -- 2.16.6