Commit Graph

59 Commits

Author SHA1 Message Date
Matthew Fisher 9d7b269499
fix recursion count in templates
backport of #7558 from master

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2020-03-20 10:01:34 -07:00
Matthew Fisher af3a021406
fix(engine): allow limited recursion in templates
This is a backport for PR 7443.

Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
2020-03-20 09:50:46 -07:00
Martin Hickey c3060582bf
Port PR 7114 to Helm 2 (#7128)
Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
2019-12-11 08:03:21 +00:00
Till Hoffmann 8648ccf5d3 fixed typo
Signed-off-by: Till Hoffmann <till.hoffmann@enforge.de>
2019-09-27 12:47:18 +02:00
lIuDuI 9fb9850aca Fix function comment to consistent with its name (#5294)
Signed-off-by: xichengliudui <1693291525@qq.com>
2019-02-12 06:26:24 -08:00
Helgi Þormar Þorbjörnsson 15703cb199 Return empty string instead of nil when linting on required (#4748)
* Return empty string instead of nil when linting on required

This allows lint to work in scenarios when required is used in secrets or it's output is passed to another function.
Due to lint mode no longer failing on missing value in required it is passing nil through which not all functions can accept.

Fixes #4747

Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>

* Apply suggestions from code review

Co-Authored-By: helgi <70530+helgi@users.noreply.github.com>
Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>

* Add tests

Signed-off-by: Helgi Þorbjörnsson <helgith@gmail.com>
2018-12-05 13:30:42 -08:00
Sean Eagan 6635bff38f fix(engine): Fix template rendering thread safety issue (#4828)
Remove the engine `currentTemplates` field which was shared state
across threads and thus not thread safe, and instead just pass these
reference templates as parameters down recursively.

Closes #4819

Signed-off-by: Sean Eagan <sean.eagan@att.com>
2018-11-06 14:00:26 -08:00
Matthew Fisher 3f0c6c5404
Merge pull request #4221 from cmattoon/issue-2347
Do not fail linting because of missing 'required' template values
2018-08-31 17:29:26 -07:00
Matthew Fisher 2d77db11fa change copyright to "Copyright The Helm Authors" 2018-07-30 08:29:17 -07:00
Curtis Mattoon 8ce64076d3 Do not fail linting because of missing 'required' template values 2018-06-14 12:50:20 -04:00
scriptonist 5311bf40a8 Now returning error and stopping installation 2018-03-13 16:33:10 +05:30
scriptonist 6cfaa4ebf2 Added code to recover from a tiller pod crash in an event of template render failure 2018-03-09 18:30:01 +05:30
Lukas Eichler 8bc7dede18
fix(helm): Apply PR comments for tpl template name fix
Modified existing unit test to verify the changed behavior.
Removed debug print.
2017-12-03 17:39:51 +01:00
Lukas Eichler 1cebc760a0
Fixed warning for missing formating parameter inside error message. 2017-12-03 17:39:51 +01:00
Lukas Eichler 2c338db1bd
fix(helm): Set template context inside tpl function to outer function.
docs(helm): Added documentation about tpl function
2017-12-03 17:39:51 +01:00
Lukas Eichler 39db9ec6e8 Merge branch 'master' into master 2017-06-08 18:40:34 +02:00
Lukas Eichler 439f1b31d1 Added unit test for include in tpl function 2017-05-28 10:55:15 +02:00
Lukas Eichler ce8e8d6778 Added storage of parsed templates in engine 2017-05-28 08:35:18 +02:00
Matt Butcher 8937c775a9
fix(2452): sort templates before parse
This sorts templates by depth before sending them to the template
parser. Deepest templates are parsed first, with umbrella templates
parsed last. Since template definition names are LIFO, that means that
the highest level templates will claim the namespace.

Or, to put it simply, you can predictably override a child's defined
template by re-defining it in a parent chart.

Closes #2452
2017-05-26 18:01:49 -06:00
Matt Butcher 5c227bffbb Merge pull request #2361 from databus23/dont_render_partials
Skip rendering partials
2017-05-05 16:44:30 -06:00
Lukas Eichler 2521c526d9 - Changed error behaviour to returning an error instead of writing the error in the template
- Added tests for using a function inside a template that is evaluated using the "tpl" function
2017-05-02 09:44:26 +02:00
Lukas Eichler d01f7978d2 Added implementation for a tpl function that evaluates a string as a template.
Implementation for #1978
2017-05-02 09:44:26 +02:00
Fabian Ruff b94eb82d12 Skip rendering partials
The output of a rendered partial is not used and rendering it might fail if it expects different values
2017-05-01 02:00:09 +02:00
Fabian Ruff 124235ffed Fail template execution if included template fails 2017-04-30 01:00:31 +02:00
Steve Wilkerson 79a3db0a63 feat(helm): add support for required properties
Adds the `required` function in enginge.go to support required
properties in values.yml. When a chart developer wishes to specify
intent in requiring a value, they can use this function to declare
an error message that gets returned when chart rendering fails
when a required value is not present in values.yml.

Closes #1580
2017-03-08 12:49:23 -06:00
Fabian Ruff 43a6bcff40 Add .Template.BasePath to template system 2017-03-06 23:19:49 +01:00
Jack Zampolin fc60d51be9 Add toToml function 2017-03-01 10:19:21 -08:00
YuviPanda 5c52fe6ad6 Add ToJson and FromJson template functions 2017-02-21 00:34:17 -08:00
Matt Butcher cb0a6c7e07
feat(tiller): add {{.Capabilities}} object
This adds the {{.Capabilities}} object to the template variables so that
chart authors can write charts that are aware of teh Kubernetes
capabilities of the current cluster.

Closes #1608
2017-01-09 18:09:20 -07:00
Matt Butcher d8540d78f1
feat(tiller): add fromYaml to template functions
This adds a fromYaml template function.

Closes #1604
2016-12-14 16:47:25 -07:00
Andrew Stuart 6760aa1588
Add Lines method, remove path utils (Sprig pr) 2016-12-12 17:19:47 -07:00
Andrew Stuart 5d58b7792c
Fix erroneous import 2016-12-09 14:06:56 -07:00
Andrew Stuart 9771973888
Add AsSecrets, AsConfig methods for Files object. Move ToYaml to chartutil 2016-12-09 12:53:53 -07:00
Matt Butcher 36f7eb0b2a fix(linter): add engine.FuncMap so linter can use real function list
This adds a function engine.FuncMap that returns a function mapping that
better represents the functions passed to a template. The linting logic
is reconfigured to use this function instead of the sprig.FuncMap
function.

Closes #1366
2016-10-14 16:28:43 -06:00
Matt Butcher 431cc46cad feat(tiller): add toYaml template function
This adds the function toYaml to the Engine template functions.

Closes #1225
2016-09-26 14:33:54 -06:00
vaikas-google 492dbb3791 Add support for NOTES.txt file 2016-08-29 13:11:16 -07:00
Matt Butcher 84761a559a fix(helm): remove extra linter output
Closes #1076
2016-08-23 11:01:18 -06:00
Matt Butcher 9718c9e7c8 feat(engine): add 'partial' function
This adds a context-aware template function called 'partial' that will
allow rendering other templates in a chart into a string value, which
can then be piped to other functions. Usage is something like
'{{partial 'path/to/template.yaml' | indent 2}}'

This might be a bad idea.

Closes #1005
2016-08-01 16:30:34 -06:00
Matt Butcher 033dbfe75e feat(tiller): add Files map to templates
Templates can now access the non-template files in a chart by using
the '{{.Files}}' map inside of a template.

Relates to #950
2016-07-29 16:04:48 -06:00
Matt Butcher 73a2890277 fix(engine): change template naming
Template paths were relative to the chart that contained them, which
meant that all templates were named 'template/SOMETHING'. This made it
trivially easy to hit namespace collisions as in #933.

Template path names are essentially opaque strings so this patch simply
changes them to be qualified by parent chart.
2016-07-07 11:39:47 -06:00
Matt Butcher 532f03ec78 feat(tiller): add .Template object in templates
This allows templates to access information about the template file.
Right now, the template can only access the .Template.Name, which is the
chart-relative path to the current template.

Closes #894
2016-06-28 16:18:08 -06:00
Matt Butcher ab4e20c278 Merge pull request #888 from technosophos/fix/887-no-value-fix
fix(tiller): stop printing <no value> when var is missing
2016-06-27 14:07:45 -06:00
Matt Butcher 96ac6ebc6c fix(tiller): stop printing <no value> when var is missing
Instead of printing "no value", this prints an empty string by
default, but adds a Strict flag on the engine, which (if true)
will cause a template render to error out if a value is not supplied.

Strict is set to false so that developers can instead use `default` to
set default values.
2016-06-24 16:25:43 -06:00
Miguel Martinez 2eff17cb6d Removing debugging line 2016-06-24 12:11:12 -07:00
Matt Butcher e00f774a5d fix(engine): remove debugging output 2016-06-24 12:06:52 -06:00
Matt Butcher 22ac61469f feat(*): add Values namespace to templates
This adds the .Values namespace qualifier to all values
2016-06-24 12:06:52 -06:00
Matt Butcher e757b24aed fix(*): add license header 2016-06-22 12:28:45 -06:00
Matt Butcher 490cef784c fix(tiller): refactor template render to use chartutil. 2016-06-13 13:11:39 -06:00
Matt Butcher e8109048a9 fix(chartutil): move values coalescing into chartutil 2016-06-09 14:10:12 -06:00
Matt Butcher 9ca8c27e16 fix(*): change TOML to YAML 2016-06-06 21:12:36 -06:00