expose kafkaURI; add sdcore-prom-kafka chart
Change-Id: I43a7d9875dc2d9d4739c0abd745a51062940a70b
diff --git a/sdcore-prom-kafka/templates/_helpers.tpl b/sdcore-prom-kafka/templates/_helpers.tpl
new file mode 100644
index 0000000..b913531
--- /dev/null
+++ b/sdcore-prom-kafka/templates/_helpers.tpl
@@ -0,0 +1,57 @@
+{{/* vim: set filetype=mustache: */}}
+{{/*
+SPDX-FileCopyrightText: 2022-present Intel Corporation
+SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+SPDX-License-Identifier: Apache-2.0
+
+Expand the name of the chart.
+*/}}
+{{- define "sdcore-prom-kafka.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 "sdcore-prom-kafka.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 "sdcore-prom-kafka.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+
+
+{{/*
+Common labels
+*/}}
+{{- define "sdcore-prom-kafka.labels" -}}
+helm.sh/chart: {{ include "sdcore-prom-kafka.chart" . }}
+{{ include "sdcore-prom-kafka.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end -}}
+
+{{/*
+Selector labels
+*/}}
+{{- define "sdcore-prom-kafka.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "sdcore-prom-kafka.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end -}}
diff --git a/sdcore-prom-kafka/templates/configmap.yaml b/sdcore-prom-kafka/templates/configmap.yaml
new file mode 100644
index 0000000..b4de909
--- /dev/null
+++ b/sdcore-prom-kafka/templates/configmap.yaml
@@ -0,0 +1,17 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ template "sdcore-prom-kafka.fullname" . }}-logconfig
+ labels:
+ app: {{ template "sdcore-prom-kafka.fullname" . }}
+ chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+ release: "{{ .Release.Name }}"
+ heritage: "{{ .Release.Service }}"
+data:
+ logging.yaml: |-
+{{ toYaml .Values.logging | indent 4 }}
diff --git a/sdcore-prom-kafka/templates/deployment.yaml b/sdcore-prom-kafka/templates/deployment.yaml
new file mode 100644
index 0000000..3604f41
--- /dev/null
+++ b/sdcore-prom-kafka/templates/deployment.yaml
@@ -0,0 +1,63 @@
+# SPDX-FileCopyrightText: 2022-present Intel Corporation
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ name: {{ template "sdcore-prom-kafka.fullname" . }}
+ namespace: {{ .Release.Namespace }}
+ labels:
+ name: {{ template "sdcore-prom-kafka.fullname" . }}
+spec:
+ replicas: {{ .Values.replicaCount }}
+ selector:
+ matchLabels:
+ {{- include "sdcore-prom-kafka.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ labels:
+ name: {{ template "sdcore-prom-kafka.fullname" . }}
+ {{- include "sdcore-prom-kafka.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-kafka"
+ {{ if .Values.kafkaURI }}
+ - "-kafka_uri={{ .Values.kafkaURI }}"
+ {{ end }}
+ {{ if .Values.prometheusEndpoint }}
+ - "-endpoint={{ .Values.prometheusEndpoint }}"
+ {{ end }}
+ volumeMounts:
+ - name: logconfig
+ mountPath: /etc/onos/config
+ readOnly: true
+ volumes:
+ - name: logconfig
+ configMap:
+ name: {{ template "sdcore-prom-kafka.fullname" . }}-logconfig
+