Add ability to configure whether to deploy kpi-exporter
Also, add release name as a prefix to kpi-exporter resource names to
in line with other resources created by nem-monitoring.
Change-Id: I2b15f97128795e19d56a1be2a9290e8775f389e2
diff --git a/nem-monitoring/Chart.yaml b/nem-monitoring/Chart.yaml
index 5fef10c..e03beee 100644
--- a/nem-monitoring/Chart.yaml
+++ b/nem-monitoring/Chart.yaml
@@ -18,4 +18,4 @@
description: Time Series Storage and Dashboard for CORD
icon: https://guide.opencord.org/logos/cord.svg
-version: 1.2.0
+version: 1.2.1
diff --git a/nem-monitoring/templates/_helpers.tpl b/nem-monitoring/templates/_helpers.tpl
index 9b0b99b..1237811 100644
--- a/nem-monitoring/templates/_helpers.tpl
+++ b/nem-monitoring/templates/_helpers.tpl
@@ -32,3 +32,20 @@
port: 8080
description: http target for prometheus
{{- end -}}
+
+{{/*
+Create a default fully qualified kpi-exporter name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+*/}}
+{{- define "kpi-exporter.fullname" -}}
+{{- if .Values.kpi_exporter.fullnameOverride -}}
+{{- .Values.kpi_exporter.fullnameOverride | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default "nem-kpi-exporter" .Values.kpi_exporter.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
diff --git a/nem-monitoring/templates/exporter-configmap.yaml b/nem-monitoring/templates/exporter-configmap.yaml
index 69d2ae3..6107f7e 100644
--- a/nem-monitoring/templates/exporter-configmap.yaml
+++ b/nem-monitoring/templates/exporter-configmap.yaml
@@ -1,7 +1,9 @@
+{{- if .Values.kpi_exporter.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
- name: exporter-configmap
+ name: {{ template "kpi-exporter.fullname" . }}
data:
conf.yaml: |
{{ include "exporter.config" . | indent 4 }}
+{{- end }}
diff --git a/nem-monitoring/templates/exporter-deployment.yaml b/nem-monitoring/templates/exporter-deployment.yaml
index 1611239..f49029f 100644
--- a/nem-monitoring/templates/exporter-deployment.yaml
+++ b/nem-monitoring/templates/exporter-deployment.yaml
@@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- if .Values.kpi_exporter.enabled }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
- name: kpi-exporter
+ name: {{ template "kpi-exporter.fullname" . }}
labels:
release: {{ .Release.Name }}
spec:
@@ -43,4 +44,5 @@
volumes:
- name: exporter-config
configMap:
- name: exporter-configmap
+ name: {{ template "kpi-exporter.fullname" . }}
+{{- end }}
diff --git a/nem-monitoring/templates/exporter-service.yaml b/nem-monitoring/templates/exporter-service.yaml
index f29a913..72434ef 100644
--- a/nem-monitoring/templates/exporter-service.yaml
+++ b/nem-monitoring/templates/exporter-service.yaml
@@ -13,10 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+{{- if .Values.kpi_exporter.enabled }}
apiVersion: v1
kind: Service
metadata:
- name: kpi-exporter
+ name: {{ template "kpi-exporter.fullname" . }}
labels:
release: {{ .Release.Name }}
spec:
@@ -28,3 +29,4 @@
protocol: TCP
selector:
app: "kpi-exporter"
+{{- end }}
diff --git a/nem-monitoring/values.yaml b/nem-monitoring/values.yaml
index 6d123bf..761d461 100644
--- a/nem-monitoring/values.yaml
+++ b/nem-monitoring/values.yaml
@@ -23,6 +23,9 @@
pullPolicy: 'Always'
kpi_exporter:
+ enabled: true
+ fullnameOverride: ''
+ nameOverride: ''
nem_kpi_exporter_nodePort: 31080
nem_kpi_exporter_replicas: 2
kpi_broker: cord-kafka:9092
@@ -59,7 +62,7 @@
scrape_interval: 15s
static_configs:
- targets:
- - kpi-exporter:8080
+ - nem-monitoring-nem-kpi-exporter:8080
- job_name: 'node-exporter'
metrics_path: /metrics
scrape_interval: 15s