Helm Named Templates: Difference between revisions
Jump to navigation
Jump to search
(→define) |
|||
Line 14: | Line 14: | ||
=Actions= | =Actions= | ||
==define== | ==define== | ||
The 'define' action defines the name and the content of the sub-template: | |||
<syntaxhighlight lang='yaml'> | |||
{{- define "mychart.mysubtemplate.labels" }} | |||
labels: | |||
color: blue | |||
date: {{ now | htmlDate }} | |||
{{- end }} | |||
</syntaxhighlight> | |||
==template== | ==template== | ||
=include Function= | =include Function= | ||
=TODEPLETE= | =TODEPLETE= | ||
{{Internal|tmp|tmp}} | {{Internal|tmp|tmp}} |
Revision as of 22:45, 7 October 2020
External
Internal
Overview
A named template, also known as a partial, sub-template or embedded template, is a fragment of text that is declared in one file and then rendered in-line into another template, usually defined in a different file, every time it is invoked with the template action or the include function.
A sub-template is defined with the define action. A sub-template name has a name, declared when the sub-template is defined.
Sub-Template Elements
Sub-Template Name
Sub-Template Scope
Actions
define
The 'define' action defines the name and the content of the sub-template:
{{- define "mychart.mysubtemplate.labels" }}
labels:
color: blue
date: {{ now | htmlDate }}
{{- end }}