{{/* Expand the name of the chart. */}} {{- define "clearml.name" -}} {{- .Release.Name | trunc 59 | trimSuffix "-" }} {{- end }} {{/* Create chart name and version as used by the chart label. */}} {{- define "clearml.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 59 | trimSuffix "-" }} {{- end }} {{/* Common labels */}} {{- define "clearml.labels" -}} helm.sh/chart: {{ include "clearml.chart" . }} {{ include "clearml.selectorLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- if $.Values.agentk8sglue.labels }} {{ toYaml $.Values.agentk8sglue.labels }} {{- end }} {{- end }} {{/* Common annotations */}} {{- define "clearml.annotations" -}} {{- if $.Values.agentk8sglue.annotations }} {{ toYaml $.Values.agentk8sglue.annotations }} {{- end }} {{- end }} {{/* Selector labels */}} {{- define "clearml.selectorLabels" -}} app.kubernetes.io/name: {{ include "clearml.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} {{/* Selector labels (agentk8sglue) */}} {{- define "agentk8sglue.selectorLabels" -}} app.kubernetes.io/name: {{ include "clearml.name" . }} app.kubernetes.io/instance: {{ include "clearml.name" . }} {{- end }} {{/* Create the name of the service account to use */}} {{- define "clearml.serviceAccountName" -}} {{- if .Values.agentk8sglue.serviceExistingAccountName }} {{- .Values.agentk8sglue.serviceExistingAccountName }} {{- else }} {{- include "clearml.name" . }}-sa {{- end }} {{- end }} {{/* Create secret to access docker registry */}} {{- define "imagePullSecret" }} {{- with .Values.imageCredentials }} {{- printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"email\":\"%s\",\"auth\":\"%s\"}}}" .registry .username .password .email (printf "%s:%s" .username .password | b64enc) | b64enc }} {{- end }} {{- end }} {{/* Create a string composed by queue names */}} {{- define "agentk8sglue.queues" -}} {{- $list := list }} {{- range $key, $value := .Values.enterpriseFeatures.queues }} {{- $list = append $list (printf "%s" $key) }} {{- end }} {{- join " " $list }} {{- end }}