From e464479cb2bb9b7228f595e513622bef2b173946 Mon Sep 17 00:00:00 2001 From: Joan Rieu Date: Mon, 30 Oct 2017 22:58:17 +0100 Subject: [PATCH 1/3] docs(templates): fix misleading/broken examples --- docs/charts_tips_and_tricks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 885c30085..1573f2edd 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -18,11 +18,11 @@ We also added two special template functions: `include` and `required`. The `inc function allows you to bring in another template, and then pass the results to other template functions. -For example, this template snippet includes a template called `mytpl.tpl`, then +For example, this template snippet includes a template called `mytpl`, then lowercases the result, then wraps that in double quotes. ```yaml -value: {{include "mytpl.tpl" . | lower | quote}} +value: {{include "mytpl" . | lower | quote}} ``` The `required` function allows you to declare a particular @@ -144,7 +144,7 @@ spec: template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + checksum/config: {{ .Files.Get "path/to/config" | sha256sum }} [...] ``` From 25e851ecd03301030aa76b106520a52ec2a8f44e Mon Sep 17 00:00:00 2001 From: Joan Rieu Date: Mon, 30 Oct 2017 23:08:50 +0100 Subject: [PATCH 2/3] docs(templates): fix and expand config checksum example --- docs/charts_tips_and_tricks.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 1573f2edd..f1faca100 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -134,9 +134,8 @@ be updated with a subsequent `helm upgrade`, but if the deployment spec itself didn't change the application keeps running with the old configuration resulting in an inconsistent deployment. -The `sha256sum` function can be used together with the `include` -function to ensure a deployments template section is updated if another -spec changes: +The `sha256sum` function can be used to ensure a deployment's +annotation section is updated if another file changes: ```yaml kind: Deployment @@ -148,6 +147,9 @@ spec: [...] ``` +See also the `helm upgrade --recreate-pods` flag for a slightly +different way of addressing this issue. + ## Tell Tiller Not To Delete a Resource Sometimes there are resources that should not be deleted when Helm runs a From 0af689b48976c50570155a9324eb13d44bbfac44 Mon Sep 17 00:00:00 2001 From: Joan Rieu Date: Mon, 30 Oct 2017 23:19:16 +0100 Subject: [PATCH 3/3] docs(templates): remove link to changed example --- docs/chart_template_guide/builtin_objects.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/builtin_objects.md b/docs/chart_template_guide/builtin_objects.md index 2e1a5d8a3..11982229b 100644 --- a/docs/chart_template_guide/builtin_objects.md +++ b/docs/chart_template_guide/builtin_objects.md @@ -27,7 +27,7 @@ In the previous section, we use `{{.Release.Name}}` to insert the name of a rele - `Capabilities.TillerVersion` provides a way to look up the Tiller version. It has the following values: `SemVer`, `GitCommit`, and `GitTreeState`. - `Template`: Contains information about the current template that is being executed - `Name`: A namespaced filepath to the current template (e.g. `mychart/templates/mytemplate.yaml`) - - `BasePath`: The namespaced path to the templates directory of the current chart (e.g. `mychart/templates`). This can be used to [include template files](https://github.com/kubernetes/helm/blob/master/docs/charts_tips_and_tricks.md#automatically-roll-deployments-when-configmaps-or-secrets-change) + - `BasePath`: The namespaced path to the templates directory of the current chart (e.g. `mychart/templates`). The values are available to any top-level template. As we will see later, this does not necessarily mean that they will be available _everywhere_.