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

     1  {{- /*
     2  name defines a template for the name of the chart. It should be used for the `app` label. 
     3  This is common practice in many Kubernetes manifests, and is not Helm-specific.
     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.nameOverride: Replaces the computed name with this given name
    11  - .Values.namePrefix: Prefix
    12  - .Values.global.namePrefix: Global prefix
    13  - .Values.nameSuffix: Suffix
    14  - .Values.global.nameSuffix: Global suffix
    15  
    16  The applied order is: "global prefix + prefix + name + suffix + global suffix"
    17  
    18  Usage: 'name: "{{- template "common.name" . -}}"'
    19  */ -}}
    20  {{- define "common.name"}}
    21    {{- $global := default (dict) .Values.global -}}
    22    {{- $base := default .Chart.Name .Values.nameOverride -}}
    23    {{- $gpre := default "" $global.namePrefix -}}
    24    {{- $pre := default "" .Values.namePrefix -}}
    25    {{- $suf := default "" .Values.nameSuffix -}}
    26    {{- $gsuf := default "" $global.nameSuffix -}}
    27    {{- $name := print $gpre $pre $base $suf $gsuf -}}
    28    {{- $name | lower | trunc 54 | trimSuffix "-" -}}
    29  {{- end -}}