Chronos exporter: added rasa-model-server helm chart(AETHER-2977)

Change-Id: Ib62791c2f609b21844b4575fae543fd1ee7a0d00
diff --git a/chronos-umbrella/Chart.yaml b/chronos-umbrella/Chart.yaml
index df160ed..20fff04 100644
--- a/chronos-umbrella/Chart.yaml
+++ b/chronos-umbrella/Chart.yaml
@@ -7,7 +7,7 @@
 description: Chronos Umbrella chart to deploy all Aether ROC

 kubeVersion: ">=1.18.0"

 type: application

-version: 0.1.13

+version: 0.1.14

 appVersion: v0.0.0

 keywords:

   - aether

@@ -34,3 +34,7 @@
     condition: import.aether-enterprise-portal.enabled

     repository: "file://../aether-enterprise-portal"

     version: 0.0.4

+  - name: rasa-model-server

+    condition: import.rasa-model-server.enabled

+    repository: "file://../rasa-model-server"

+    version: 0.0.1

diff --git a/rasa-model-server/.helmignore b/rasa-model-server/.helmignore
new file mode 100644
index 0000000..5e5908d
--- /dev/null
+++ b/rasa-model-server/.helmignore
@@ -0,0 +1,25 @@
+# SPDX-FileCopyrightText: 2022 Open Networking Foundation

+#

+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+

+# 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

diff --git a/rasa-model-server/Chart.yaml b/rasa-model-server/Chart.yaml
new file mode 100644
index 0000000..143b49c
--- /dev/null
+++ b/rasa-model-server/Chart.yaml
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>

+#

+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+

+apiVersion: v2

+name: rasa-model-server

+description: Rasa Model Server

+kubeVersion: ">=1.15.0"

+type: application

+version: 0.0.1

+appVersion: v0.0.11

+keywords:

+  - aether

+  - exporter

+home: https://www.opennetworking.org/aether/

+maintainers:

+  - name: Aether Ops team

+    email: support@opennetworking.org

diff --git a/rasa-model-server/README.md b/rasa-model-server/README.md
new file mode 100644
index 0000000..1b6cd77
--- /dev/null
+++ b/rasa-model-server/README.md
@@ -0,0 +1,9 @@
+<!--

+SPDX-FileCopyrightText: 2022 Open Networking Foundation

+

+SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+-->

+

+## Rasa Model Server

+

+Provides a [Helm] chart for deploying Rasa Model Server on [Kubernetes].

diff --git a/rasa-model-server/files/certs/README.md b/rasa-model-server/files/certs/README.md
new file mode 100644
index 0000000..ff75757
--- /dev/null
+++ b/rasa-model-server/files/certs/README.md
@@ -0,0 +1,32 @@
+<!--

+SPDX-FileCopyrightText: 2022 Open Networking Foundation

+

+SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+-->

+

+This folder contains self-signed certificates for use in testing. _DO NOT USE THESE

+CERTIFICATES IN PRODUCTION!_

+

+The certificates were generated with the

+https://github.com/onosproject/simulators/blob/master/pkg/certs/generate_certs.sh 

+script as

+```bash

+generate_certs.sh sdcore-adapter

+```

+

+In this folder they **must** be (re)named

+* tls.cacrt

+* tls.crt

+* tls.key

+

+Use

+```bash

+openssl x509 -in deployments/helm/onos-config/files/certs/tls.crt -text -noout

+```

+to verify the contents (especially the subject).

+

+There is another Cert for onos-config in test/certs but these were created with:

+```

+generate-certs.sh onos-config

+```

+and are left named onf.cacrt, onos-config.key and onos-config.crt

diff --git a/rasa-model-server/files/certs/tls.cacert b/rasa-model-server/files/certs/tls.cacert
new file mode 100644
index 0000000..3dcb76b
--- /dev/null
+++ b/rasa-model-server/files/certs/tls.cacert
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----

+MIIDYDCCAkgCCQDe99fSN9qxSTANBgkqhkiG9w0BAQsFADByMQswCQYDVQQGEwJV

+UzELMAkGA1UECAwCQ0ExEjAQBgNVBAcMCU1lbmxvUGFyazEMMAoGA1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SQaGka3W

+eEfVeA==

+-----END CERTIFICATE-----

diff --git a/rasa-model-server/files/certs/tls.crt b/rasa-model-server/files/certs/tls.crt
new file mode 100644
index 0000000..a634ab0
--- /dev/null
+++ b/rasa-model-server/files/certs/tls.crt
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----

+MIIDYzCCAksCFErBGzsXHo1l8bmZRmDkF+h2bsdWMA0GCSqGSIb3DQEBCwUAMHIx

+CzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDQTESMBAGA1UEBwwJTWVubG9QYXJrMQww

+CgYDVQQKDANPTkYxFDASBgNVBAsMC0VuZ2luZWVyaW5nMR4wHAYDVQQDDBVjYS5v

+cGVubmV0d29ya2luZy5vcmcwHhcNMjExMTA1MTQyNzU0WhcNMzExMTAzMTQyNzU0

+WjBqMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ0ExEjAQBgNVBAcMCU1lbmxvUGFy

+azEMMAoGA1UECgwDT05GMRQwEgYDVQQLDAtFbmdpbmVlcmluZzEWMBQGA1UEAwwN

+ZGVtby1leHBvcnRlcjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPUf

+jSlFz8wQBeUid4hUq8gL9Tggoe38QX26j/XuLsbM0dxzJMD2k2nDXOz0caMlUYqX

+sOSn5GRtoZsVa9lKbNTxF9HkEPLV7CWv+gqRXYOOPI9Wjr5lDKufxeKKXrW+zJvu

+gUWRQ+l9bZLb7KHbhQ+mmLQC1/r+PgS1CIMc1PQ560FPpI9w+cl3IeY8XvEvKDGE

+cxroDfPqrv0gTtOekuGBVQj1ivUg+SdfyP8j5RX/RyCUfuWJoNJEDWKioKKBjrhK

+rP17yILr0RZst8tAuwxJXruMzNDribYgJn3bXHUQjX1tiFr48ProjfQCr77Elvd9

+DSd4XxtPwomJPXcQKN0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAXFs7WVelZ+6X

+ASTmhLZtzoWtBOjPCGEnBrK2SHVRHbaVLBBaZp/sW2+XkPMQrHwWVpFP+7ttrJ0V

+fsfGlRrZ6uxB9MDK9D2RS6Zo8HKUXCQWs4VRcw7Zzy1NPa4MLBAXRxLv83t4UfAj

+cUFkZ0UhKlFJNUZ74AcMBzK121BzxmDCDwnZWyeqzB8SKexdk8I+sEoc5/KIM/QP

+LdTKe3vw/WGH7p45M693BXWc5lyAcwB8iSmecjlPB5peN71sY3OeSJGUvS+Qbdla

+FBPC5tNbp4byRVciyLKnwxg4HmOfNhCZbRVYG2WHBaT7oMtx+4DaNs8ePwWIwvko

+ga0pInZUNg==

+-----END CERTIFICATE-----

diff --git a/rasa-model-server/files/certs/tls.key b/rasa-model-server/files/certs/tls.key
new file mode 100644
index 0000000..bc89538
--- /dev/null
+++ b/rasa-model-server/files/certs/tls.key
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----

+MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQD1H40pRc/MEAXl

+IneIVKvIC/U4IKHt/EF9uo/17i7GzNHccyTA9pNpw1zs9HGjJVGKl7Dkp+RkbaGb

+FWvZSmzU8RfR5BDy1ewlr/oKkV2DjjyPVo6+ZQyrn8Xiil61vsyb7oFFkUPpfW2S

+2+yh24UPppi0Atf6/j4EtQiDHNT0OetBT6SPcPnJdyHmPF7xLygxhHMa6A3z6q79

+IE7TnpLhgVUI9Yr1IPknX8j/I+UV/0cglH7liaDSRA1ioqCigY64Sqz9e8iC69EW

+bLfLQLsMSV67jMzQ64m2ICZ921x1EI19bYha+PD66I30Aq++xJb3fQ0neF8bT8KJ

+iT13ECjdAgMBAAECggEAHFfroKwb3QK1S8tyeucffeA0GKtdTgFvKTSbVNqXuhEQ

+6ya9Rzq7zOz0H8ocIbs89IOZxrbLJ/mtSBtv/w4mC3FdSb3PX+Twi2MPzI0GfSHD

+Sue9VbKlhmrRHOLXFLjdO+KWPA8SBTuloeegMw8JEcg3vAjgJHulfDHarB53WU3n

+QXm34u759a4xGFFGtHW7wzDjsnt6Cm78Moi3IIbs40cE7EbUkGoHYstaQH8Kl2CI

+TIFcT2KuzJ057dxcS6KsBNbbyG0vbcBjV+221EGIcjuj7p53XhhLIE1p4tdv+9TG

+SZDPpgKLjMkIqeeq7It2XAG3sCkirwzEF7n+rVCeAQKBgQD6rnUX8Xr0r5lgPNIO

+Nsgop/aRQ/bfYNZfMP7kNLooq9efMPoxqaaCysMa+IjkCaCowladoQRtaWGp/iVM

+hjwE/l/oEASe8NDUUqk2w2SdNos6Cm9sj00TfCBqMhOKkAxbEZWMJxJ73hXYbkTt

+I/5rVj2dqE7YVCO2umExe91enQKBgQD6Uue+7iFdp77aghScEic109pEXoDfdcoa

+6ThDuroSb+f/YIl5na8IrXYQve40ycf2O9z3M2Sg9GczYqfSL1wMaVnkGUgkihJN

+W5yhDpqfkNMVJLQLTzX3dNQ3y10+XAneSuclY5gH0RBp4vfnn1r7vrP+ZhFx9khi

+aNyQbhS/QQKBgAz6dUN9FBGQ+c7at0FXIrvAHmrc6u4btF2PStMDy9OJOgua3Ikv

+sFg7KSi/T08HFJNIJHXavUDw4MaNSt8QYBEeHlcEZUjZTOaBNROJwC7HgSPLIIOt

+U587oO3+k7ZryMf6PBTafQF+uQDQjK7+WxCxkVUVPqfCi2rNcXS/ZfGdAoGAH9zp

+rr309Uzi2EFyiiMtZoae49D7qnX90csZ5FUiVjJ0X2dUWGyf2QTrYFostf9xOoCI

+MdcS2gICGOJX5kMs/k9yp7woGK6SgdJFb6LCP8lZdPmFCWN9xQ/T634xUjy47Niv

+72xr76LG6hN/5rW8CQtPMfSgB9eHgy9B1AiPD4ECgYBOyipIZ9YJG/gcOmWqgRdv

+22lD8nl0hU7El4gHhWYzABApglpCwwcE+GLK9h/9KZbOEIQs7itzZFEQCX1VbuUo

+8+JWR8ZsimMSmLb5ySF3hMbevaA6iYNjjpvDy1syFNW+WVefp7nf1zQB4qRMW1vb

+p0dF88DF/NJK1kAC2RBZew==

+-----END PRIVATE KEY-----

diff --git a/rasa-model-server/templates/_helpers.tpl b/rasa-model-server/templates/_helpers.tpl
new file mode 100644
index 0000000..893acd0
--- /dev/null
+++ b/rasa-model-server/templates/_helpers.tpl
@@ -0,0 +1,56 @@
+{{/* vim: set filetype=mustache: */}}

+{{/*

+SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>

+SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+

+Expand the name of the chart.

+*/}}

+{{- define "rasa-model-server.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 "rasa-model-server.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 "rasa-model-server.chart" -}}

+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}

+{{- end -}}

+

+

+{{/*

+Common labels

+*/}}

+{{- define "rasa-model-server.labels" -}}

+helm.sh/chart: {{ include "rasa-model-server.chart" . }}

+{{ include "rasa-model-server.selectorLabels" . }}

+{{- if .Chart.AppVersion }}

+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}

+{{- end }}

+app.kubernetes.io/managed-by: {{ .Release.Service }}

+{{- end -}}

+

+{{/*

+Selector labels

+*/}}

+{{- define "rasa-model-server.selectorLabels" -}}

+app.kubernetes.io/name: {{ include "rasa-model-server.name" . }}

+app.kubernetes.io/instance: {{ .Release.Name }}

+{{- end -}}

diff --git a/rasa-model-server/templates/deployment.yaml b/rasa-model-server/templates/deployment.yaml
new file mode 100644
index 0000000..588de74
--- /dev/null
+++ b/rasa-model-server/templates/deployment.yaml
@@ -0,0 +1,64 @@
+# SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>

+#

+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+

+apiVersion: apps/v1

+kind: Deployment

+metadata:

+  name: {{ template "rasa-model-server.fullname" . }}

+  namespace: {{ .Release.Namespace }}

+  labels:

+    name: {{ template "rasa-model-server.fullname" . }}

+spec:

+  replicas: {{ .Values.replicaCount }}

+  selector:

+    matchLabels:

+      {{- include "rasa-model-server.selectorLabels" . | nindent 6 }}

+  template:

+    metadata:

+      labels:

+        name: {{ template "rasa-model-server.fullname" . }}

+        {{- include "rasa-model-server.selectorLabels" . | nindent 8 }}

+    spec:

+    {{- with .Values.imagePullSecrets }}

+      imagePullSecrets:

+        {{- toYaml . | nindent 6 }}

+    {{- end }}

+      securityContext:

+        {{- toYaml .Values.podSecurityContext | nindent 8 }}

+      containers:

+        - name: {{ .Chart.Name }}

+          image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"

+          imagePullPolicy: {{ .Values.image.pullPolicy }}

+          env:

+            - name: POD_NAMESPACE

+              valueFrom:

+                fieldRef:

+                  fieldPath: metadata.namespace

+            - name: POD_NAME

+              valueFrom:

+                fieldRef:

+                  fieldPath: metadata.name

+            - name: NODE_NAME

+              valueFrom:

+                fieldRef:

+                  fieldPath: spec.nodeName

+          args:

+            - "/usr/local/bin/rasa-model-server"

+            - "--modelPath"

+            - {{ .Values.modelfiles }}

+          ports:

+            - name: models

+              containerPort: 8080

+          readinessProbe:

+            httpGet:

+              path: /models/sample1

+              port: 8080

+            initialDelaySeconds: 5

+            periodSeconds: 10

+          livenessProbe:

+            httpGet:

+              path: /models/sample1

+              port: 8080

+            initialDelaySeconds: 15

+            periodSeconds: 20

diff --git a/rasa-model-server/templates/secret.yaml b/rasa-model-server/templates/secret.yaml
new file mode 100644
index 0000000..292c0c1
--- /dev/null
+++ b/rasa-model-server/templates/secret.yaml
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>

+#

+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+

+apiVersion: v1

+kind: Secret

+metadata:

+  name: {{ template "rasa-model-server.fullname" . }}-secret

+  labels:

+     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"

+     release: "{{ .Release.Name }}"

+     heritage: "{{ .Release.Service }}"

+data:

+  {{ $root := . }}

+  {{ range $path, $bytes := .Files.Glob "files/certs/tls.*" }}

+  {{ base $path }}: '{{ $root.Files.Get $path | b64enc }}'

+  {{ end }}

+type: Opaque

diff --git a/rasa-model-server/templates/service.yaml b/rasa-model-server/templates/service.yaml
new file mode 100644
index 0000000..56e85d2
--- /dev/null
+++ b/rasa-model-server/templates/service.yaml
@@ -0,0 +1,20 @@
+# SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>

+#

+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+apiVersion: v1

+kind: Service

+metadata:

+  name: {{ template "rasa-model-server.fullname" . }}

+  labels:

+    app: {{ template "rasa-model-server.fullname" . }}

+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"

+    release: "{{ .Release.Name }}"

+    heritage: "{{ .Release.Service }}"

+    {{- include "rasa-model-server.labels" . | nindent 4 }}

+spec:

+  type: {{ .Values.service.type }}

+  selector:

+    name: {{ template "rasa-model-server.fullname" . }}

+  ports:

+  - name: models

+    port: 8080

diff --git a/rasa-model-server/values.yaml b/rasa-model-server/values.yaml
new file mode 100644
index 0000000..33b3618
--- /dev/null
+++ b/rasa-model-server/values.yaml
@@ -0,0 +1,20 @@
+# SPDX-FileCopyrightText: 2022-present Open Networking Foundation <info@opennetworking.org>

+#

+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0

+

+nameOverride: ""

+fullnameOverride: "rasa-model-server"

+

+replicaCount: 1

+annotations: {}

+

+image:

+  repository: onosproject/chronos-exporter

+  tag: v0.0.11

+  pullPolicy: IfNotPresent

+  pullSecrets: []

+

+service:

+  type: ClusterIP

+

+modelfiles: /opt/rasa-models/