aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl
diff options
context:
space:
mode:
authorDileep Ranganathan <dileep.ranganathan@intel.com>2019-05-30 12:38:37 -0700
committerDileep Ranganathan <dileep.ranganathan@intel.com>2019-05-30 21:11:52 +0000
commit3d5a3e06530c1250d48f7d838c619f3bfbcd019d (patch)
tree349e370c43ce7318b3f7eb7736345de6872cbef2 /vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl
parent31802660dfe74a8671ae29789f0018f0f887ea1a (diff)
Refactor Distributed Analytics project structure
Modified the project structure to improve maintainability and to add future CI and integration test support. Change-Id: Id30bfb1f83f23785a6b5f99e81f42f752d59c0f8 Issue-ID: ONAPARC-280 Signed-off-by: Dileep Ranganathan <dileep.ranganathan@intel.com>
Diffstat (limited to 'vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl')
-rw-r--r--vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl91
1 files changed, 91 insertions, 0 deletions
diff --git a/vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl b/vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl
new file mode 100644
index 00000000..6ec1fa2b
--- /dev/null
+++ b/vnfs/DAaaS/deploy/operator/charts/prometheus-operator/templates/_helpers.tpl
@@ -0,0 +1,91 @@
+{{/* vim: set filetype=mustache: */}}
+{{/* Expand the name of the chart. This is suffixed with -alertmanager, which means subtract 13 from longest 63 available */}}
+{{- define "prometheus-operator.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 50 | 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.
+The components in this chart create additional resources that expand the longest created name strings.
+The longest name that gets created adds and extra 37 characters, so truncation should be 63-35=26.
+*/}}
+{{- define "prometheus-operator.fullname" -}}
+{{- if .Values.fullnameOverride -}}
+{{- .Values.fullnameOverride | trunc 26 | trimSuffix "-" -}}
+{{- else -}}
+{{- $name := default .Chart.Name .Values.nameOverride -}}
+{{- if contains $name .Release.Name -}}
+{{- .Release.Name | trunc 26 | trimSuffix "-" -}}
+{{- else -}}
+{{- printf "%s-%s" .Release.Name $name | trunc 26 | trimSuffix "-" -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+
+{{/* Fullname suffixed with operator */}}
+{{- define "prometheus-operator.operator.fullname" -}}
+{{- printf "%s-operator" (include "prometheus-operator.fullname" .) -}}
+{{- end }}
+
+{{/* Fullname suffixed with prometheus */}}
+{{- define "prometheus-operator.prometheus.fullname" -}}
+{{- printf "%s-prometheus" (include "prometheus-operator.fullname" .) -}}
+{{- end }}
+
+{{/* Fullname suffixed with alertmanager */}}
+{{- define "prometheus-operator.alertmanager.fullname" -}}
+{{- printf "%s-alertmanager" (include "prometheus-operator.fullname" .) -}}
+{{- end }}
+
+{{/* Create chart name and version as used by the chart label. */}}
+{{- define "prometheus-operator.chartref" -}}
+{{- replace "+" "_" .Chart.Version | printf "%s-%s" .Chart.Name -}}
+{{- end }}
+
+{{/* Generate basic labels */}}
+{{- define "prometheus-operator.labels" }}
+chart: {{ template "prometheus-operator.chartref" . }}
+release: {{ .Release.Name | quote }}
+heritage: {{ .Release.Service | quote }}
+{{- if .Values.commonLabels}}
+{{ toYaml .Values.commonLabels }}
+{{- end }}
+{{- end }}
+
+{{/* Create the name of prometheus-operator service account to use */}}
+{{- define "prometheus-operator.operator.serviceAccountName" -}}
+{{- if and .Values.global.rbac.create .Values.prometheusOperator.serviceAccount.create -}}
+ {{ default (include "prometheus-operator.operator.fullname" .) .Values.prometheusOperator.serviceAccount.name }}
+{{- else -}}
+ {{ default "default" .Values.prometheusOperator.serviceAccount.name }}
+{{- end -}}
+{{- end -}}
+
+{{/* Create the name of prometheus service account to use */}}
+{{- define "prometheus-operator.prometheus.serviceAccountName" -}}
+{{- if and .Values.global.rbac.create .Values.prometheus.serviceAccount.create -}}
+ {{ default (include "prometheus-operator.prometheus.fullname" .) .Values.prometheus.serviceAccount.name }}
+{{- else -}}
+ {{ default "default" .Values.prometheus.serviceAccount.name }}
+{{- end -}}
+{{- end -}}
+
+{{/* Create the name of alertmanager service account to use */}}
+{{- define "prometheus-operator.alertmanager.serviceAccountName" -}}
+{{- if and .Values.global.rbac.create .Values.alertmanager.serviceAccount.create -}}
+ {{ default (include "prometheus-operator.alertmanager.fullname" .) .Values.alertmanager.serviceAccount.name }}
+{{- else -}}
+ {{ default "default" .Values.alertmanager.serviceAccount.name }}
+{{- end -}}
+{{- end -}}
+
+{{/* Workaround for https://github.com/helm/helm/issues/3117 */}}
+{{- define "prometheus-operator.rangeskipempty" -}}
+{{- range $key, $value := . }}
+{{- if $value }}
+{{ $key }}: {{ $value }}
+{{- end }}
+{{- end }}
+{{- end }}