From b5cae82278c894a407f8a4150325b45b0ee5c2bc Mon Sep 17 00:00:00 2001 From: Chi-En Wu Date: Thu, 23 Apr 2020 16:19:20 +0800 Subject: [PATCH] refactor: remove duplicate template `common.chart` --- README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README.md b/README.md index 5fc3da1..4e70d6f 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ It provides utilities that reflect best practices of Kubernetes chart developmen * [`common.serviceMonitor`](#commonservicemonitor) * [`common.serviceMonitor.secret`](#commonservicemonitorsecret) - [Partial Objects](#partial-objects) + * [`common.chart`](#commonchart) * [`common.container`](#commoncontainer) * [`common.fullname`](#commonfullname) * [`common.labels`](#commonlabels) @@ -731,6 +732,26 @@ When writing Kubernetes resources, you may find the following helpers useful to +### `common.chart` + +The `common.chart` helper prints the chart name and version, escaped to be legal in a Kubernetes label field. + +Example template: + +```yaml +helm.sh/chart: {{ include "common.chart" . }} +``` + +For the chart `foo` with version `1.2.3-beta.55+1234`, this will render: + +```yaml +helm.sh/chart: foo-1.2.3-beta.55_1234 +``` + +(Note that `+` is an illegal character in label values) + + + ### `common.container` The `common.container` template accepts a list of three values: