Initial commit for chronos-umbrella

Change-Id: Ice4173f994e049c5ef333046438b27a1a396e234
diff --git a/chronos-exporter/.helmignore b/chronos-exporter/.helmignore
new file mode 100644
index 0000000..afb7893
--- /dev/null
+++ b/chronos-exporter/.helmignore
@@ -0,0 +1,25 @@
+# SPDX-FileCopyrightText: 2021 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/chronos-exporter/Chart.yaml b/chronos-exporter/Chart.yaml
new file mode 100644
index 0000000..070ed85
--- /dev/null
+++ b/chronos-exporter/Chart.yaml
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>

+#

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

+

+apiVersion: v2

+name: chronos-exporter

+description: Chronos Exporter

+kubeVersion: ">=1.15.0"

+type: application

+version: 0.0.1

+appVersion: v0.0.0

+keywords:

+  - aether

+  - exporter

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

+maintainers:

+  - name: Aether Ops team

+    email: support@opennetworking.org

diff --git a/chronos-exporter/README.md b/chronos-exporter/README.md
new file mode 100644
index 0000000..01259c0
--- /dev/null
+++ b/chronos-exporter/README.md
@@ -0,0 +1,9 @@
+<!--

+SPDX-FileCopyrightText: 2021 Open Networking Foundation

+

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

+-->

+

+## Chronos Exporter

+

+Provides a [Helm] chart for deploying Chronos Exporter on [Kubernetes].

diff --git a/chronos-exporter/files/certs/README.md b/chronos-exporter/files/certs/README.md
new file mode 100644
index 0000000..65c5a42
--- /dev/null
+++ b/chronos-exporter/files/certs/README.md
@@ -0,0 +1,32 @@
+<!--

+SPDX-FileCopyrightText: 2021 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
\ No newline at end of file
diff --git a/chronos-exporter/files/certs/tls.cacert b/chronos-exporter/files/certs/tls.cacert
new file mode 100644
index 0000000..3dcb76b
--- /dev/null
+++ b/chronos-exporter/files/certs/tls.cacert
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----

+MIIDYDCCAkgCCQDe99fSN9qxSTANBgkqhkiG9w0BAQsFADByMQswCQYDVQQGEwJV

+UzELMAkGA1UECAwCQ0ExEjAQBgNVBAcMCU1lbmxvUGFyazEMMAoGA1UECgwDT05G

+MRQwEgYDVQQLDAtFbmdpbmVlcmluZzEeMBwGA1UEAwwVY2Eub3Blbm5ldHdvcmtp

+bmcub3JnMB4XDTE5MDQxMTA5MDYxM1oXDTI5MDQwODA5MDYxM1owcjELMAkGA1UE

+BhMCVVMxCzAJBgNVBAgMAkNBMRIwEAYDVQQHDAlNZW5sb1BhcmsxDDAKBgNVBAoM

+A09ORjEUMBIGA1UECwwLRW5naW5lZXJpbmcxHjAcBgNVBAMMFWNhLm9wZW5uZXR3

+b3JraW5nLm9yZzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMEg7CZR

+X8Y+syKHaQCh6mNIL1D065trwX8RnuKM2kBwSu034zefQAPloWugSoJgJnf5fe0j

+nUD8gN3Sm8XRhCkvf67pzfabgw4n8eJmHScyL/ugyExB6Kahwzn37bt3oT3gSqhr

+6PUznWJ8fvfVuCHZZkv/HPRp4eyAcGzbJ4TuB0go4s6VE0WU5OCxCSlAiK3lvpVr

+3DOLdYLVoCa5q8Ctl3wXDrfTLw5/Bpfrg9fF9ED2/YKIdV8KZ2ki/gwEOQqWcKp8

+0LkTlfOWsdGjp4opPuPT7njMBGXMJzJ8/J1e1aJvIsoB7n8XrfvkNiWL5U3fM4N7

+UZN9jfcl7ULmm7cCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAIh6FjkQuTfXddmZY

+FYpoTen/VD5iu2Xxc1TexwmKeH+YtaKp1Zk8PTgbCtMEwEiyslfeHTMtODfnpUIk

+DwvtB4W0PAnreRsqh9MBzdU6YZmzGyZ92vSUB3yukkHaYzyjeKM0AwgVl9yRNEZw

+Y/OM070hJXXzJh3eJpLl9dlUbMKzaoAh2bZx6y3ZJIZFs/zrpGfg4lvBAvfO/59i

+mxJ9bQBSN3U2Hwp6ioOQzP0LpllfXtx9N5LanWpB0cu/HN9vAgtp3kRTBZD0M1XI

+Ctit8bXV7Mz+1iGqoyUhfCYcCSjuWTgAxzir+hrdn7uO67Hv4ndCoSj4SQaGka3W

+eEfVeA==

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

diff --git a/chronos-exporter/files/certs/tls.crt b/chronos-exporter/files/certs/tls.crt
new file mode 100644
index 0000000..a634ab0
--- /dev/null
+++ b/chronos-exporter/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/chronos-exporter/files/certs/tls.key b/chronos-exporter/files/certs/tls.key
new file mode 100644
index 0000000..bc89538
--- /dev/null
+++ b/chronos-exporter/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/chronos-exporter/templates/_helpers.tpl b/chronos-exporter/templates/_helpers.tpl
new file mode 100644
index 0000000..190001f
--- /dev/null
+++ b/chronos-exporter/templates/_helpers.tpl
@@ -0,0 +1,56 @@
+{{/* vim: set filetype=mustache: */}}

+{{/*

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

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

+

+Expand the name of the chart.

+*/}}

+{{- define "chronos-exporter.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 "chronos-exporter.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 "chronos-exporter.chart" -}}

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

+{{- end -}}

+

+

+{{/*

+Common labels

+*/}}

+{{- define "chronos-exporter.labels" -}}

+helm.sh/chart: {{ include "chronos-exporter.chart" . }}

+{{ include "chronos-exporter.selectorLabels" . }}

+{{- if .Chart.AppVersion }}

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

+{{- end }}

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

+{{- end -}}

+

+{{/*

+Selector labels

+*/}}

+{{- define "chronos-exporter.selectorLabels" -}}

+app.kubernetes.io/name: {{ include "chronos-exporter.name" . }}

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

+{{- end -}}

diff --git a/chronos-exporter/templates/deployment.yaml b/chronos-exporter/templates/deployment.yaml
new file mode 100644
index 0000000..0ad83eb
--- /dev/null
+++ b/chronos-exporter/templates/deployment.yaml
@@ -0,0 +1,66 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>

+#

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

+

+apiVersion: apps/v1

+kind: Deployment

+metadata:

+  name: {{ template "chronos-exporter.fullname" . }}

+  namespace: {{ .Release.Namespace }}

+  labels:

+    name: {{ template "chronos-exporter.fullname" . }}

+spec:

+  replicas: {{ .Values.replicaCount }}

+  selector:

+    matchLabels:

+      {{- include "chronos-exporter.selectorLabels" . | nindent 6 }}

+  template:

+    metadata:

+      labels:

+        name: {{ template "chronos-exporter.fullname" . }}

+        {{- include "chronos-exporter.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/chronos-exporter"

+          ports:

+            - name: metrics

+              containerPort: 2112

+          readinessProbe:

+            httpGet:

+              path: /metrics

+              port: 2112

+            initialDelaySeconds: 5

+            periodSeconds: 10

+          livenessProbe:

+            httpGet:

+              path: /metrics

+              port: 2112

+            initialDelaySeconds: 15

+            periodSeconds: 20

+      volumes:

+        - name: secret

+          secret:

+            secretName: {{ template "chronos-exporter.fullname" . }}-secret
\ No newline at end of file
diff --git a/chronos-exporter/templates/secret.yaml b/chronos-exporter/templates/secret.yaml
new file mode 100644
index 0000000..be9e3f9
--- /dev/null
+++ b/chronos-exporter/templates/secret.yaml
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>

+#

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

+

+apiVersion: v1

+kind: Secret

+metadata:

+  name: {{ template "chronos-exporter.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/chronos-exporter/templates/service.yaml b/chronos-exporter/templates/service.yaml
new file mode 100644
index 0000000..0bc44d0
--- /dev/null
+++ b/chronos-exporter/templates/service.yaml
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>

+#

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

+apiVersion: v1

+kind: Service

+metadata:

+  name: {{ template "chronos-exporter.fullname" . }}

+  labels:

+    app: {{ template "chronos-exporter.fullname" . }}

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

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

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

+    {{- include "chronos-exporter.labels" . | nindent 4 }}

+spec:

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

+  selector:

+    name: {{ template "chronos-exporter.fullname" . }}

+  ports:

+  - name: metrics

+    port: 2112

+  - name: exporterui

+    port: 8081

diff --git a/chronos-exporter/values.yaml b/chronos-exporter/values.yaml
new file mode 100644
index 0000000..b73cc4e
--- /dev/null
+++ b/chronos-exporter/values.yaml
@@ -0,0 +1,18 @@
+# SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org>

+#

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

+

+nameOverride: ""

+fullnameOverride: "chronos-exporter"

+

+replicaCount: 1

+annotations: {}

+

+image:

+  repository: onosproject/chronos-exporter

+  tag: latest

+  pullPolicy: IfNotPresent

+  pullSecrets: []

+

+service:

+  type: ClusterIP