github.com/zsuzhengdu/helm@v3.0.0-beta.3+incompatible/cmd/helm/testdata/testcharts/chart-with-template-lib-dep/charts/common/templates/_fullname.tpl (about)

     1  {{- /*
     2  fullname defines a suitably unique name for a resource by combining
     3  the release name and the chart name.
     4  
     5  The prevailing wisdom is that names should only contain a-z, 0-9 plus dot (.) and dash (-), and should
     6  not exceed 63 characters.
     7  
     8  Parameters:
     9  
    10  - .Values.fullnameOverride: Replaces the computed name with this given name
    11  - .Values.fullnamePrefix: Prefix
    12  - .Values.global.fullnamePrefix: Global prefix
    13  - .Values.fullnameSuffix: Suffix
    14  - .Values.global.fullnameSuffix: Global suffix
    15  
    16  The applied order is: "global prefix + prefix + name + suffix + global suffix"
    17  
    18  Usage: 'name: "{{- template "common.fullname" . -}}"'
    19  */ -}}
    20  {{- define "common.fullname"}}
    21    {{- $global := default (dict) .Values.global -}}
    22    {{- $base := default (printf "%s-%s" .Release.Name .Chart.Name) .Values.fullnameOverride -}}
    23    {{- $gpre := default "" $global.fullnamePrefix -}}
    24    {{- $pre := default "" .Values.fullnamePrefix -}}
    25    {{- $suf := default "" .Values.fullnameSuffix -}}
    26    {{- $gsuf := default "" $global.fullnameSuffix -}}
    27    {{- $name := print $gpre $pre $base $suf $gsuf -}}
    28    {{- $name | lower | trunc 54 | trimSuffix "-" -}}
    29  {{- end -}}
    30  
    31  {{- /*
    32  common.fullname.unique adds a random suffix to the unique name.
    33  
    34  This takes the same parameters as common.fullname
    35  
    36  */ -}}
    37  {{- define "common.fullname.unique" -}}
    38    {{ template "common.fullname" . }}-{{ randAlphaNum 7 | lower }}
    39  {{- end }}