From 4377cc6b77948ae3d280d48288370db5b50b6ac2 Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Sat, 25 Jan 2020 00:00:07 +0100 Subject: [COMMON] Allow to generate fullname based on passed chart name By default common.fullname uses .Chart.Name or .Values.nameOverride to generate a "full name" used in many places. In some cases it may be convenient to be able to generate this full name for a specific, well known chart name. Issue-ID: OOM-2249 Change-Id: I68034c1c5df81ae9533f5f4bc6fab58f2416623a Signed-off-by: Krzysztof Opasiak --- kubernetes/common/common/templates/_name.tpl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'kubernetes') diff --git a/kubernetes/common/common/templates/_name.tpl b/kubernetes/common/common/templates/_name.tpl index 9b7e69046a..7719cdbb9f 100644 --- a/kubernetes/common/common/templates/_name.tpl +++ b/kubernetes/common/common/templates/_name.tpl @@ -21,13 +21,23 @@ {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* + The same as common.full name but based on passed dictionary instead of trying to figure + out chart name on its own. +*/}} +{{- define "common.fullnameExplicit" -}} + {{- $dot := .dot }} + {{- $name := .chartName }} + {{- printf "%s-%s" (include "common.release" $dot) $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{/* Create a default fully qualified application name. Truncated at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "common.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} - {{- printf "%s-%s" (include "common.release" .) $name | trunc 63 | trimSuffix "-" -}} + {{- include "common.fullnameExplicit" (dict "dot" . "chartName" $name) }} {{- end -}} {{/* -- cgit 1.2.3-korg