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/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 -}}