github.com/y-taka-23/helm@v2.8.0+incompatible/docs/chart_template_guide/builtin_objects.md (about) 1 # Built-in Objects 2 3 Objects are passed into a template from the template engine. And your code can pass objects around (we'll see examples when we look at the `with` and `range` statements). There are even a few ways to create new objects within your templates, like with the `tuple` function we'll see later. 4 5 Objects can be simple, and have just one value. Or they can contain other objects or functions. For example. the `Release` object contains several objects (like `Release.Name`) and the `Files` object has a few functions. 6 7 In the previous section, we use `{{.Release.Name}}` to insert the name of a release into a template. `Release` is one of the top-level objects that you can access in your templates. 8 9 - `Release`: This object describes the release itself. It has several objects inside of it: 10 - `Release.Name`: The release name 11 - `Release.Time`: The time of the release 12 - `Release.Namespace`: The namespace to be released into (if the manifest doesn't override) 13 - `Release.Service`: The name of the releasing service (always `Tiller`). 14 - `Release.Revision`: The revision number of this release. It begins at 1 and is incremented for each `helm upgrade`. 15 - `Release.IsUpgrade`: This is set to `true` if the current operation is an upgrade or rollback. 16 - `Release.IsInstall`: This is set to `true` if the current operation is an install. 17 - `Values`: Values passed into the template from the `values.yaml` file and from user-supplied files. By default, `Values` is empty. 18 - `Chart`: The contents of the `Chart.yaml` file. Any data in `Chart.yaml` will be accessible here. For example `{{.Chart.Name}}-{{.Chart.Version}}` will print out the `mychart-0.1.0`. 19 - The available fields are listed in the [Charts Guide](https://github.com/kubernetes/helm/blob/master/docs/charts.md#the-chartyaml-file) 20 - `Files`: This provides access to all non-special files in a chart. While you cannot use it to access templates, you can use it to access other files in the chart. See the section _Accessing Files_ for more. 21 - `Files.Get` is a function for getting a file by name (`.Files.Get config.ini`) 22 - `Files.GetBytes` is a function for getting the contents of a file as an array of bytes instead of as a string. This is useful for things like images. 23 - `Capabilities`: This provides information about what capabilities the Kubernetes cluster supports. 24 - `Capabilities.APIVersions` is a set of versions. 25 - `Capabilities.APIVersions.Has $version` indicates whether a version (`batch/v1`) is enabled on the cluster. 26 - `Capabilities.KubeVersion` provides a way to look up the Kubernetes version. It has the following values: `Major`, `Minor`, `GitVersion`, `GitCommit`, `GitTreeState`, `BuildDate`, `GoVersion`, `Compiler`, and `Platform`. 27 - `Capabilities.TillerVersion` provides a way to look up the Tiller version. It has the following values: `SemVer`, `GitCommit`, and `GitTreeState`. 28 - `Template`: Contains information about the current template that is being executed 29 - `Name`: A namespaced filepath to the current template (e.g. `mychart/templates/mytemplate.yaml`) 30 - `BasePath`: The namespaced path to the templates directory of the current chart (e.g. `mychart/templates`). 31 32 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_. 33 34 The built-in values always begin with a capital letter. This is in keeping with Go's naming convention. When you create your own names, you are free to use a convention that suits your team. Some teams, like the [Kubernetes Charts](https://github.com/kubernetes/charts) team, choose to use only initial lower case letters in order to distinguish local names from those built-in. In this guide, we follow that convention. 35