refactor: remove duplicate template common.name

This commit is contained in:
Chi-En Wu
2020-04-23 16:06:44 +08:00
parent 264d45a564
commit 69997fbf23

View File

@ -24,6 +24,7 @@ It provides utilities that reflect best practices of Kubernetes chart developmen
* [`common.container`](#commoncontainer)
* [`common.labels`](#commonlabels)
* [`common.metadata`](#commonmetadata)
* [`common.name`](#commonname)
* [`common.pod.template`](#commonpodtemplate)
* [`common.selectorLabels`](#commonselectorlabels)
@ -928,6 +929,35 @@ Most of the common templates that define a resource type (e.g. `common.configMap
### `common.name`
The `common.name` template generates a name suitable for the `app.kubernetes.io/name` label. It is used like this:
```yaml
app.kubernetes.io/name: {{ include "common.name" . }}
```
This prints the value of `{{ .Chart.Name }}` by default, but can be overridden with `.Values.nameOverride`:
```yaml
nameOverride: some-name
```
Example output:
```yaml
---
# with the values above
app.kubernetes.io/name: some-name
---
# the default, for chart "mychart"
app.kubernetes.io/name: mychart
```
Output of this function is truncated at 63 characters, which is the maximum length of name.
### `common.pod.template`
The `common.pod.template` template accepts a list of three values: