|
| 1 | +{{/* vim: set filetype=mustache: */}} |
| 2 | + |
| 3 | +{{/* |
| 4 | +Expand the name of the chart. |
| 5 | +*/}} |
| 6 | +{{- define "nlk.name" -}} |
| 7 | +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} |
| 8 | +{{- end }} |
| 9 | + |
| 10 | +{{/* |
| 11 | +Create a default fully qualified app name. |
| 12 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 13 | +If release name contains chart name it will be used as a full name. |
| 14 | +*/}} |
| 15 | +{{- define "nlk.fullname" -}} |
| 16 | +{{- if .Values.fullnameOverride }} |
| 17 | +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} |
| 18 | +{{- else }} |
| 19 | +{{- $name := default .Chart.Name .Values.nameOverride }} |
| 20 | +{{- if contains $name .Release.Name }} |
| 21 | +{{- .Release.Name | trunc 63 | trimSuffix "-" }} |
| 22 | +{{- else }} |
| 23 | +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} |
| 24 | +{{- end }} |
| 25 | +{{- end }} |
| 26 | +{{- end }} |
| 27 | + |
| 28 | +{{/* |
| 29 | +Create a default fully qualified nlk name. |
| 30 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 31 | +*/}} |
| 32 | +{{- define "nlk.nlk.fullname" -}} |
| 33 | +{{- printf "%s-%s" (include "nlk.fullname" .) .Values.nlk.name | trunc 63 | trimSuffix "-" -}} |
| 34 | +{{- end -}} |
| 35 | + |
| 36 | +{{/* |
| 37 | +Create a default fully qualified nlk service name. |
| 38 | +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). |
| 39 | +*/}} |
| 40 | +{{- define "nlk.nlk.service.name" -}} |
| 41 | +{{- default (include "nlk.nlk.fullname" .) .Values.serviceNameOverride | trunc 63 | trimSuffix "-" -}} |
| 42 | +{{- end -}} |
| 43 | + |
| 44 | +{{/* |
| 45 | +Create chart name and version as used by the chart label. |
| 46 | +*/}} |
| 47 | +{{- define "nlk.chart" -}} |
| 48 | +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} |
| 49 | +{{- end }} |
| 50 | + |
| 51 | +{{/* |
| 52 | +Common labels |
| 53 | +*/}} |
| 54 | +{{- define "nlk.labels" -}} |
| 55 | +helm.sh/chart: {{ include "nlk.chart" . }} |
| 56 | +{{ include "nlk.selectorLabels" . }} |
| 57 | +{{- if .Chart.AppVersion }} |
| 58 | +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} |
| 59 | +{{- end }} |
| 60 | +app.kubernetes.io/managed-by: {{ .Release.Service }} |
| 61 | +{{- end }} |
| 62 | + |
| 63 | +{{/* |
| 64 | +Selector labels |
| 65 | +*/}} |
| 66 | +{{- define "nlk.selectorLabels" -}} |
| 67 | +{{- if .Values.nlk.selectorLabels -}} |
| 68 | +{{ toYaml .Values.nlk.selectorLabels }} |
| 69 | +{{- else -}} |
| 70 | +app.kubernetes.io/name: {{ include "nlk.name" . }} |
| 71 | +app.kubernetes.io/instance: {{ .Release.Name }} |
| 72 | +{{- end -}} |
| 73 | +{{- end -}} |
| 74 | + |
| 75 | +{{/* |
| 76 | +Expand the name of the configmap. |
| 77 | +*/}} |
| 78 | +{{- define "nlk.configName" -}} |
| 79 | +{{- if .Values.nlk.customConfigMap -}} |
| 80 | +{{ .Values.nlk.customConfigMap }} |
| 81 | +{{- else -}} |
| 82 | +{{- default (include "nlk.fullname" .) .Values.nlk.config.name -}} |
| 83 | +{{- end -}} |
| 84 | +{{- end -}} |
| 85 | + |
| 86 | +{{/* |
| 87 | +Expand service account name. |
| 88 | +*/}} |
| 89 | +{{- define "nlk.serviceAccountName" -}} |
| 90 | +{{- default (include "nlk.fullname" .) .Values.nlk.serviceAccount.name -}} |
| 91 | +{{- end -}} |
| 92 | + |
| 93 | +{{- define "nlk.tag" -}} |
| 94 | +{{- default .Chart.AppVersion .Values.nlk.image.tag -}} |
| 95 | +{{- end -}} |
| 96 | + |
| 97 | +{{/* |
| 98 | +Expand image name. |
| 99 | +*/}} |
| 100 | +{{- define "nlk.image" -}} |
| 101 | +{{- if .Values.nlk.image.digest -}} |
| 102 | +{{- printf "%s@%s" .Values.nlk.image.repository .Values.nlk.image.digest -}} |
| 103 | +{{- else -}} |
| 104 | +{{- printf "%s:%s" .Values.nlk.image.repository (include "nlk.tag" .) -}} |
| 105 | +{{- end -}} |
| 106 | +{{- end -}} |
| 107 | + |
| 108 | +{{- define "nlk.prometheus.serviceName" -}} |
| 109 | +{{- printf "%s-%s" (include "nlk.fullname" .) "prometheus-service" -}} |
| 110 | +{{- end -}} |
0 commit comments