{{- define "common.names.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- define "common.names.chart" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- define "common.names.fullname" -}} {{- if .Values.fullnameOverride -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} {{- $name := default .Chart.Name .Values.nameOverride -}} {{- if contains $name .Release.Name -}} {{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- else -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- end -}} {{- end -}} {{- define "common.names.suffixedName" -}} {{- $base := trunc 54 (include "common.names.fullname" .root) -}} {{- $suffix := .suffix -}} {{- printf "%s-%s" $base $suffix | trunc 63 | trimSuffix "-" -}} {{- end -}} {{- define "common.labels.standard" -}} app.kubernetes.io/name: {{ include "common.names.name" . }} helm.sh/chart: {{ include "common.names.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} {{- define "common.labels.matchLabels" -}} app.kubernetes.io/name: {{ include "common.names.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} {{- define "common.tplvalues.render" -}} {{- $value := typeIs "string" .value | ternary .value (.value | toYaml) }} {{- if contains "{{" (toJson .value) }} {{- if .scope }} {{- tpl (cat "{{- with $.RelativeScope -}}" $value "{{- end }}") (merge (dict "RelativeScope" .scope) .context) }} {{- else }} {{- tpl $value .context }} {{- end }} {{- else }} {{- $value }} {{- end }} {{- end -}} {{- define "common.tplvalues.merge" -}} {{- $dst := dict -}} {{- range .values -}} {{- $dst = include "common.tplvalues.render" (dict "value" . "context" $.context "scope" $.scope) | fromYaml | merge $dst -}} {{- end -}} {{ $dst | toYaml }} {{- end -}}