You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/values-templating/readme.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
1
# [ALPHA] Values & Templates Example
2
2
3
-
This example demonstrates the pre-release alpha version of Zarf's values templating system, including support for **Sprig functions** for advanced template processing and **Helm chart value overrides**.
3
+
This example demonstrates the pre-release alpha version of Zarf's values templating system, including support for **Sprig functions** for advanced template processing, **Helm chart value overrides**, and **cluster state access** via `.State`.
4
4
5
5
## Features Demonstrated
6
6
7
7
-**Basic templating** with `{{ .Values.* }}`, `{{ .Build.* }}`, `{{ .Metadata.* }}`, `{{ .Constants.* }}`, and `{{ .Variables.* }}`
8
+
-**Cluster state** with `{{ .State.Registry.Address }}`, `{{ .State.StorageClass }}`, `{{ .State.IPFamily }}`, and other non-sensitive runtime fields via `.State`
8
9
-**Sprig functions** for string manipulation, lists, math, encoding, and more
9
10
-**File templating** with both simple substitution and complex transformations
10
11
-**Dynamic configuration** using template functions for practical Kubernetes deployments
Copy file name to clipboardExpand all lines: site/src/content/docs/ref/values.mdx
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -155,3 +155,42 @@ In addition to user supplied Variables, and Constants, Zarf maintains a list of
155
155
Because files can be deployed without a Kubernetes cluster, some built-in values such as `###ZARF_REGISTRY###` may not be available if no previous component has required access to the cluster. If you need one of these built-in values, a prior component will need to have been called that requires access to the cluster, such as `images`, `repos`, `charts`, `manifests`, or `dataInjections`.
156
156
157
157
:::
158
+
159
+
### Cluster State (`.State`)
160
+
161
+
The `.State` object exposes Zarf cluster state in **manifests**, **files**, and **action `cmd` fields** that have `template: true` set.
162
+
163
+
**Non-sensitive fields** are always available with no additional declaration:
164
+
165
+
| Field | Description |
166
+
|---|---|
167
+
| `.State.StorageClass` | Default storage class (cf. `###ZARF_STORAGE_CLASS###`) |
168
+
| `.State.IPFamily` | `"ipv4"`, `"ipv6"`, or `"dual"` (cf. `###ZARF_IPV6_ONLY###`) |
| `.State.Injector.Port` | Injector host port (cf. `###ZARF_INJECTOR_HOSTPORT###`) |
182
+
| `.State.Injector.PayloadConfigMaps` | Number of payload ConfigMaps (cf. `###ZARF_INJECTOR_PAYLOAD_CONFIGMAPS###`) |
183
+
| `.State.Injector.PayloadShaSum` | SHA sum of injector payload (cf. `###ZARF_INJECTOR_SHASUM###`) |
184
+
185
+
**Sensitive fields** require a `stateAccess` declaration on the component. Accessing a sensitive field without the corresponding group causes a template error at deploy time:
0 commit comments