From 69997fbf2368356eb663501f511db9dfd2d7038e Mon Sep 17 00:00:00 2001 From: Chi-En Wu Date: Thu, 23 Apr 2020 16:06:44 +0800 Subject: [PATCH] refactor: remove duplicate template `common.name` --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 95a095e..13ead1e 100644 --- a/README.md +++ b/README.md @@ -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: