|
| 1 | +{{/* vim: set filetype=mustache: */}} |
| 2 | +{{/* |
| 3 | +Expand the name of the chart. |
| 4 | +*/}} |
| 5 | +{{- define "nri-metadata-injection.name" -}} |
| 6 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} |
| 7 | +{{- end -}} |
| 8 | + |
| 9 | +{{/* |
| 10 | +Create a default fully qualified app name. |
| 11 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 12 | +If release name contains chart name it will be used as a full name. |
| 13 | +*/}} |
| 14 | +{{- define "nri-metadata-injection.fullname" -}} |
| 15 | +{{- if .Values.fullnameOverride -}} |
| 16 | +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} |
| 17 | +{{- else -}} |
| 18 | +{{- $name := default .Chart.Name .Values.nameOverride -}} |
| 19 | +{{- if contains $name .Release.Name -}} |
| 20 | +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} |
| 21 | +{{- else -}} |
| 22 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} |
| 23 | +{{- end -}} |
| 24 | +{{- end -}} |
| 25 | +{{- end -}} |
| 26 | + |
| 27 | +{{/* |
| 28 | +Create chart name and version as used by the chart label. |
| 29 | +*/}} |
| 30 | +{{- define "nri-metadata-injection.chart" -}} |
| 31 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} |
| 32 | +{{- end -}} |
| 33 | + |
| 34 | +{{/* |
| 35 | +Common app label |
| 36 | +*/}} |
| 37 | +{{- define "nri-metadata-injection.appLabel" -}} |
| 38 | +app.kubernetes.io/name: {{ include "nri-metadata-injection.name" . }} |
| 39 | +{{- end -}} |
| 40 | + |
| 41 | +{{/* |
| 42 | +Common labels |
| 43 | +*/}} |
| 44 | +{{- define "nri-metadata-injection.labels" -}} |
| 45 | +{{ include "nri-metadata-injection.appLabel" . }} |
| 46 | +helm.sh/chart: {{ include "nri-metadata-injection.chart" . }} |
| 47 | +app.kubernetes.io/instance: {{ .Release.Name }} |
| 48 | +{{- if .Chart.AppVersion }} |
| 49 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 50 | +{{- end }} |
| 51 | +app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 52 | +{{- end -}} |
| 53 | + |
| 54 | +{{/* |
| 55 | +Create the name of the service account to use |
| 56 | +*/}} |
| 57 | +{{- define "nri-metadata-injection.serviceAccountName" -}} |
| 58 | +{{- if .Values.serviceAccount.create -}} |
| 59 | + {{ default (include "nri-metadata-injection.fullname" .) .Values.serviceAccount.name }} |
| 60 | +{{- else -}} |
| 61 | + {{ default "default" .Values.serviceAccount.name }} |
| 62 | +{{- end -}} |
| 63 | +{{- end -}} |
| 64 | + |
| 65 | +{{/* |
| 66 | +Return the cluster |
| 67 | +*/}} |
| 68 | +{{- define "nri-metadata-injection.cluster" -}} |
| 69 | +{{- if .Values.global -}} |
| 70 | + {{- if .Values.global.cluster -}} |
| 71 | + {{- .Values.global.cluster -}} |
| 72 | + {{- else -}} |
| 73 | + {{- .Values.cluster | default "" -}} |
| 74 | + {{- end -}} |
| 75 | +{{- else -}} |
| 76 | + {{- .Values.cluster | default "" -}} |
| 77 | +{{- end -}} |
| 78 | +{{- end -}} |
0 commit comments