Skip to content

Commit

Permalink
Merge pull request #1662 from lgerard-pass/clarify-global-scope-meaning
Browse files Browse the repository at this point in the history
clarify global scope meaning for named templates
  • Loading branch information
karenhchu authored Jan 7, 2025
2 parents 350b613 + b3c4702 commit e1bc456
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion content/en/docs/chart_template_guide/named_templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ metadata:

Note that we pass `.` at the end of the `template` call. We could just as easily
pass `.Values` or `.Values.favorite` or whatever scope we want. But what we want
is the top-level scope.
is the top-level scope. In the context of the named template, `$` will refer
to the scope you passed in and not some global scope.

Now when we execute this template with `helm install --dry-run --debug
plinking-anaco ./mychart`, we get this:
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/chart_template_guide/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ That variable will be in scope for the entire template. But in our last example,
`$key` and `$val` will only be in scope inside of the `{{ range... }}{{ end }}`
block.

However, there is one variable that is always global - `$` - this variable will
always point to the root context. This can be very useful when you are looping
However, there is one variable that will always point to the root context: - `$` -.
This can be very useful when you are looping
in a range and you need to know the chart's release name.

An example illustrating this:
Expand Down

0 comments on commit e1bc456

Please sign in to comment.