Add values templating information
This commit is contained in:
parent
c46955e07c
commit
4108821efe
|
|
@ -89,6 +89,11 @@ __How changes are applied to `values.yaml`__:
|
|||
|
||||
- When changes are applied to the `values.yaml` from multiple sources at the same time, the values will update in the following order: `helm.values` -> `helm.valuesFiles` -> `helm.valuesFrom`. That means `valuesFrom` will take precedence over both, `valuesFiles` and `values`.
|
||||
|
||||

|
||||
|
||||
The targeting step can treat the values as a template and fill in information from the `clusters.fleet.cattle.io` resource. More information can be found in [Helm values templating](./ref-fleet-yaml#templating).
|
||||
This can be turned off in `fleet.yaml`, by setting `disablePreProcess`, e.g. to avoid conflicts with other templating languages.
|
||||
|
||||
:::note Credentials in Values
|
||||
|
||||
If the chart generates certificates or passwords in its templates, these values must be overriden. Otherwise the chart could be continuously deployed as these values change.
|
||||
|
|
|
|||
|
|
@ -395,10 +395,14 @@ Values are processed in different stages of the lifecycle: https://fleet.rancher
|
|||
It is possible to specify the keys and values as go template strings for
|
||||
advanced templating needs. Most of the functions from the [sprig templating
|
||||
library](https://masterminds.github.io/sprig/) are available.
|
||||
This can be turned off in `fleet.yaml`, by setting `disablePreProcess`, e.g. to
|
||||
avoid conflicts with other templating languages.
|
||||
|
||||
Note that if the functions output changes with every call, e.g. `uuidv4`, the
|
||||
bundle will get redeployed.
|
||||
|
||||
You can [test values templating with the CLI](./ref-bundle-stages#fleet-target) against existing clusters.
|
||||
|
||||
The template context has the following keys:
|
||||
|
||||
* `.ClusterValues` are retrieved from target cluster's `spec.templateValues`
|
||||
|
|
@ -426,3 +430,13 @@ will result in the following text:
|
|||
```
|
||||
foo-bar-${PWD}
|
||||
```
|
||||
|
||||
:::warning empty values
|
||||
It is easier to use `global.fleet.clusterLabels.LABELNAME` instead of templating. When using templating, make sure to protect against null values.
|
||||
|
||||
Example:
|
||||
```
|
||||
${ if hasKey .ClusterLabels "LABELNAME" }${ .ClusterLabels.LABELNAME }${ else }missing${ end}
|
||||
```
|
||||
:::
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 61 KiB |
Loading…
Reference in New Issue