Merge "Add a1 helm chart"
authorLusheng Ji <lji@research.att.com>
Mon, 24 Jun 2019 21:30:22 +0000 (21:30 +0000)
committerGerrit Code Review <gerrit@o-ran-sc.org>
Mon, 24 Jun 2019 21:30:22 +0000 (21:30 +0000)
19 files changed:
ric-platform/50-RIC-Platform/bin/install
ric-platform/50-RIC-Platform/bin/uninstall
ric-platform/50-RIC-Platform/helm/a1mediator/.gitignore [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/.helmignore [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/Chart.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/files/ricmanifest.json [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/files/rmr_string_int_mapping.txt [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/templates/_helpers.tpl [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/templates/config.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/templates/deployment.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/templates/service.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/templates/tests/test-connection.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/a1mediator/values.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/ingress-appmgr.yaml~ [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/ingress-e2mgr.yaml~ [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/ingress.yaml [new file with mode: 0644]
ric-platform/50-RIC-Platform/helm/ingress.yaml~ [new file with mode: 0644]

index 53023f3..4c97c14 100755 (executable)
@@ -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"
index b5937b1..e5a65fa 100755 (executable)
@@ -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 (file)
index 0000000..d8651e0
--- /dev/null
@@ -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 (file)
index 0000000..50af031
--- /dev/null
@@ -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 (file)
index 0000000..be6cc65
--- /dev/null
@@ -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 (file)
index 0000000..0fb5f09
--- /dev/null
@@ -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 (file)
index 0000000..f2804ad
--- /dev/null
@@ -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 (file)
index 0000000..fa46bab
--- /dev/null
@@ -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 (file)
index 0000000..afac492
--- /dev/null
@@ -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 (file)
index 0000000..7669af8
--- /dev/null
@@ -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 (file)
index 0000000..3321aa6
--- /dev/null
@@ -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 (file)
index 0000000..ca68368
--- /dev/null
@@ -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 (file)
index 0000000..d6aed57
--- /dev/null
@@ -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 (file)
index 0000000..ff890f2
--- /dev/null
@@ -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 (file)
index 0000000..ad0203b
--- /dev/null
@@ -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 (file)
index 0000000..a4cb379
--- /dev/null
@@ -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 (file)
index 0000000..3083a15
--- /dev/null
@@ -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 (file)
index 0000000..1047431
--- /dev/null
@@ -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 (file)
index 0000000..91ba4eb
--- /dev/null
@@ -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