diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-01-25 00:00:07 +0100 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2020-02-01 00:10:01 +0100 |
commit | 4377cc6b77948ae3d280d48288370db5b50b6ac2 (patch) | |
tree | 71504aec699af506280e67eb9c823383dc864e20 /kubernetes/common | |
parent | b9c30534d9af126401e1d038de0d4cf6d78b001e (diff) |
[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 <k.opasiak@samsung.com>
Diffstat (limited to 'kubernetes/common')
-rw-r--r-- | kubernetes/common/common/templates/_name.tpl | 12 |
1 files changed, 11 insertions, 1 deletions
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 @@ -22,12 +22,22 @@ {{- 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 -}} {{/* |