Add standalone R3 RIC platform helm charts and deployment scripts.

Signed-off-by: Zhe Huang <zhehuang@research.att.com>
Change-Id: Id0011e0d1d78915918736a310a444f9bf769c476
diff --git a/helm/submgr/Chart.yaml b/helm/submgr/Chart.yaml
new file mode 100644
index 0000000..10af40b
--- /dev/null
+++ b/helm/submgr/Chart.yaml
@@ -0,0 +1,22 @@
+################################################################################
+#   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.                                             #
+################################################################################
+
+appVersion: "1.0"
+apiVersion: v1
+description: Oran Subscription Manager Helm charts
+name: submgr
+version: 3.0.0
diff --git a/helm/submgr/requirements.yaml b/helm/submgr/requirements.yaml
new file mode 100644
index 0000000..db3a74b
--- /dev/null
+++ b/helm/submgr/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.0.0
+    repository: "@local"
diff --git a/helm/submgr/templates/configmap.yaml b/helm/submgr/templates/configmap.yaml
new file mode 100644
index 0000000..a8ee386
--- /dev/null
+++ b/helm/submgr/templates/configmap.yaml
@@ -0,0 +1,35 @@
+#==================================================================================
+#   Copyright (c) 2019 AT&T Intellectual Property.
+#
+#   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.
+#==================================================================================
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: submgrcfg
+  namespace: ricplt
+data:
+  # FQDN and port info of rtmgr
+  submgrcfg: |
+    "local":
+      "host": ":8080"
+    "logger":
+      "level": 3
+    "rmr":
+      "protPort" : "tcp:4560"
+      "maxSize": 2072
+      "numWorkers": 1
+    "rtmgr":
+      "hostAddr": {{ include "common.servicename.rtmgr.http" . | quote }}
+      "port"    : {{ include "common.serviceport.rtmgr.http" . }}
+      "baseUrl" : "/ric/v1"
diff --git a/helm/submgr/templates/deployment.yaml b/helm/submgr/templates/deployment.yaml
new file mode 100644
index 0000000..6f502ba
--- /dev/null
+++ b/helm/submgr/templates/deployment.yaml
@@ -0,0 +1,78 @@
+#==================================================================================
+#   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.
+#==================================================================================
+
+{{- $imagectx := dict "ctx" . "defaultregistry" .Values.submgr.image.registry }}
+{{- $pullpolicyctx := dict "ctx" . "defaultpullpolicy" .Values.submgr.imagePullPolicy }}
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: {{ include "common.deploymentname.submgr" . }}
+  namespace: {{ include "common.namespace.platform" . }}
+  labels:
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  replicas: {{ .Values.submgr.replicaCount }}
+  selector:
+    matchLabels:
+      app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+      release: {{ .Release.Name }}
+  template:
+    metadata:
+      {{- if .Values.submgr.annotations }}
+      annotations:
+        {{- .Values.submgr.annotations | nindent 8 -}}
+      {{ end }}
+      labels:
+        app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+        release: {{ .Release.Name }}
+    spec:
+      hostname: {{ include "common.name.submgr" . }}
+      imagePullSecrets:
+        - name: {{ include "common.dockerregistry.credential" $imagectx }}
+      containers:
+        - name: {{ include "common.containername.submgr" . }}
+          image: {{ include "common.dockerregistry.url" $imagectx }}/{{ .Values.submgr.image.name }}:{{ .Values.submgr.image.tag }}
+          imagePullPolicy: {{ include "common.dockerregistry.pullpolicy" $pullpolicyctx }}
+          command: ["/run_submgr.sh"]
+          envFrom:
+            - configMapRef:
+                name: {{ include "common.configmapname.submgr" . }}-env
+          ports:
+            - name: http
+              containerPort: {{ include "common.serviceport.submgr.http" . }}
+              protocol: TCP
+            - name: rmrroute
+              containerPort: {{ include "common.serviceport.submgr.rmr.route" . }}
+              protocol: TCP
+            - name: rmrdata
+              containerPort: {{ include "common.serviceport.submgr.rmr.data" . }}
+              protocol: TCP
+          volumeMounts:
+            - name: config-volume
+              mountPath: /cfg
+      volumes:
+        - name: config-volume
+          configMap:
+            name: submgrcfg
+            items:
+              - key: submgrcfg
+                path: submgr-config.yaml
+                mode: 0644
+
diff --git a/helm/submgr/templates/env.yaml b/helm/submgr/templates/env.yaml
new file mode 100644
index 0000000..9e65676
--- /dev/null
+++ b/helm/submgr/templates/env.yaml
@@ -0,0 +1,29 @@
+################################################################################
+#   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.                                             #
+################################################################################
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ include "common.configmapname.submgr" . }}-env
+data:
+  DBAAS_SERVICE_HOST: {{ include "common.servicename.dbaas.tcp" . | quote }}
+  DBAAS_SERVICE_PORT: {{ include "common.serviceport.dbaas.tcp" . | quote }}
+  DBAAS_PORT_6379_TCP_ADDR: {{ include "common.servicename.dbaas.tcp" . | quote }}
+  DBAAS_PORT_6379_TCP_PORT: {{ include "common.serviceport.dbaas.tcp" . | quote }} 
+  RMR_RTG_SVC: {{ include "common.serviceport.submgr.rmr.route" . | quote }}
+  RMR_SRC_ID: {{ include "common.servicename.submgr.rmr" . }}.{{ include "common.namespace.platform" . }}
+  CFGFILE: "/cfg/submgr-config.yaml"
+  SUBMGR_SEED_SN: "1"
diff --git a/helm/submgr/templates/service-http.yaml b/helm/submgr/templates/service-http.yaml
new file mode 100644
index 0000000..ed2d790
--- /dev/null
+++ b/helm/submgr/templates/service-http.yaml
@@ -0,0 +1,42 @@
+#
+#==================================================================================
+#   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.
+#==================================================================================
+#
+#
+#   Abstract: Subscription Manager service manifest 
+#   Date:		28 May 2019
+#
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ include "common.servicename.submgr.http" . }}
+  namespace: {{ include "common.namespace.platform" . }}
+  labels:
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  selector:
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+    release: {{ .Release.Name }}
+  clusterIP: None
+  ports:
+  - name: http
+    port: {{ include "common.serviceport.submgr.http" . }}
+    protocol: TCP
+    targetPort: http
\ No newline at end of file
diff --git a/helm/submgr/templates/service-rmr.yaml b/helm/submgr/templates/service-rmr.yaml
new file mode 100644
index 0000000..3e8107e
--- /dev/null
+++ b/helm/submgr/templates/service-rmr.yaml
@@ -0,0 +1,47 @@
+#
+#==================================================================================
+#   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.
+#==================================================================================
+#
+#
+#   Abstract: Subscription Manager service manifest 
+#   Date:		28 May 2019
+#
+kind: Service
+apiVersion: v1
+metadata:
+  name: {{ include "common.servicename.submgr.rmr" . }}
+  namespace: {{ include "common.namespace.platform" . }}
+  labels:
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+spec:
+  selector:
+    app: {{ include "common.namespace.platform" . }}-{{ include "common.name.submgr" . }}
+    release: {{ .Release.Name }}	
+  clusterIP: None
+  ports:
+  - name: rmrdata
+    port: {{ include "common.serviceport.submgr.rmr.data" . }}
+    protocol: TCP
+    targetPort: rmrdata
+  - name: rmrroute
+    port: {{ include "common.serviceport.submgr.rmr.route" . }}
+    protocol: TCP
+    targetPort: rmrroute
+
diff --git a/helm/submgr/values.yaml b/helm/submgr/values.yaml
new file mode 100644
index 0000000..63aafb6
--- /dev/null
+++ b/helm/submgr/values.yaml
@@ -0,0 +1,30 @@
+################################################################################
+#   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.                                             #
+################################################################################
+
+#################################################################
+# Application configuration defaults.
+#################################################################
+# application image
+
+submgr:
+  imagePullPolicy: IfNotPresent
+  image:
+    name: ric-plt-submgr
+    tag: 0.10.7
+    registry: "nexus3.o-ran-sc.org:10002/o-ran-sc"
+
+  replicaCount: 1