AETHER-2625 move sdcore-exporter to demo-exporter
Change-Id: I422f0f9a0436fca145b6922b3c09a51994118928
diff --git a/demo-exporter/templates/_helpers.tpl b/demo-exporter/templates/_helpers.tpl
new file mode 100644
index 0000000..5907a5b
--- /dev/null
+++ b/demo-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 "demo-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 "demo-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 "demo-exporter.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+
+{{/*
+Common labels
+*/}}
+{{- define "demo-exporter.labels" -}}
+helm.sh/chart: {{ include "demo-exporter.chart" . }}
+{{ include "demo-exporter.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end -}}
+
+{{/*
+Selector labels
+*/}}
+{{- define "demo-exporter.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "demo-exporter.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end -}}
diff --git a/demo-exporter/templates/deployment.yaml b/demo-exporter/templates/deployment.yaml
new file mode 100644
index 0000000..7846122
--- /dev/null
+++ b/demo-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 "demo-exporter.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ name: {{ template "demo-exporter.fullname" . }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ {{- include "demo-exporter.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ labels:
+ name: {{ template "demo-exporter.fullname" . }}
+ {{- include "demo-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/sdcore-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 "demo-exporter.fullname" . }}-secret
diff --git a/demo-exporter/templates/secret.yaml b/demo-exporter/templates/secret.yaml
new file mode 100644
index 0000000..6365a60
--- /dev/null
+++ b/demo-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 "demo-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/demo-exporter/templates/service.yaml b/demo-exporter/templates/service.yaml
new file mode 100644
index 0000000..880d333
--- /dev/null
+++ b/demo-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 "demo-exporter.fullname" . }}
+ labels:
+ app: {{ template "demo-exporter.fullname" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+ {{- include "demo-exporter.labels" . | nindent 4 }}
+spec:
+ type: {{ .Values.service.type }}
+ selector:
+ name: {{ template "demo-exporter.fullname" . }}
+ ports:
+ - name: metrics
+ port: 2112
+ - name: exporterui
+ port: 8081