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: platform/administer/templates/advanced/parameters.mdx
+72-42Lines changed: 72 additions & 42 deletions
Original file line number
Diff line number
Diff line change
@@ -4,20 +4,63 @@ sidebar_label: Paramenters
4
4
sidebar_position: 2
5
5
---
6
6
7
+
# Template parameters (UI workflow)
7
8
8
-
Parameters are a very powerful component of templates. These parameters allow
9
-
for giving users that may consume your template a bit of flexibility with
10
-
configuration options for certain applications, while still maintaining control over the
11
-
possible values the users can select.
9
+
Parameters let users customize specific parts of a template while keeping core settings consistent. When deploying resources from a parameterized template, the platform prompts users to enter values, which are injected into the Helm template using the `.Values` syntax.
12
10
13
-
When deploying a resource referring to a template with parameters configured, the platform
14
-
prompts the user for their selection for the given parameters.
11
+
For example:
15
12
16
-
## Parameter definition
13
+
```yaml
14
+
property: {{ .Values.exampleVariable }}
15
+
```
16
+
17
+
This lets users modify `exampleVariable` during deployment.
18
+
19
+
20
+
## Define parameters using the UI
21
+
22
+
You can use the platform UI to add and organize parameters.
23
+
24
+
<Flow id="ui-template-parameters">
25
+
<Step>
26
+
Click **Add parameter** in the template editor.
27
+
</Step>
28
+
<Step>
29
+
From the **Section** dropdown, choose or create a section (for example "Example Title") to group related parameters.
30
+
</Step>
31
+
<Step>
32
+
Enter a unique **Identifier (variable)**. This is used as the variable key in the template (for example, `{{ .Values.variableName }}`).
33
+
</Step>
34
+
<Step>
35
+
Select a **Type** for the parameter. Options include `String`, `Number`, `Boolean`, `Password`, `Multiline`.
36
+
</Step>
37
+
<Step>
38
+
Provide a **Label** that describes the parameter in a readable way for end users.
39
+
</Step>
40
+
<Step>
41
+
Add a **Description** to explain what the parameter does.
42
+
</Step>
43
+
<Step>
44
+
Toggle the **Required** option if this parameter must be filled before deployment.
45
+
</Step>
46
+
<Step>
47
+
Use **Allowed Options** to limit user input to predefined values (e.g., `some-value`, `another-value`). Click **+ Add option** to add more.
48
+
</Step>
49
+
<Step>
50
+
Click **Done** to save the parameter.
51
+
</Step>
52
+
</Flow>
53
+
54
+
Repeat these steps for each parameter. To delete a parameter, click the trash icon. To access advanced settings, use the **Advanced...** menu.
55
+
56
+
:::tip
57
+
Use sections to group related parameters and improve the user experience during deployment.
58
+
:::
59
+
60
+
61
+
## YAML parameter definition
17
62
18
-
Parameters are provided as YAML data structures. For example, with a parameters
19
-
configuration as shown below, the user gets a dialog box where they can select 'one' or
20
-
'two' as the value for the `mylabelvalue` variable.
63
+
Optionally, you can also define parameters directly in YAML. This can be useful for templates shared using Git or automated deployment workflows.
21
64
22
65
```yaml title="dialog box for user input"
23
66
- variable: mylabelvalue
@@ -29,20 +72,11 @@ configuration as shown below, the user gets a dialog box where they can select '
29
72
section: Labels
30
73
```
31
74
32
-
:::info
33
-
Parameter types can be one of the following:
34
-
- string
35
-
- multiline
36
-
- boolean
37
-
- number
38
-
- password
39
-
:::
75
+
The platform renders this as a user input dialog when deploying the resource.
40
76
41
-
Parameters can also be free-form text fields that are optionally validated. The following
42
-
snippet shows an example option that accepts a user input string and validates it against the
43
-
`validation` regular expression:
77
+
You can also use regex-based validation for free-form fields:
44
78
45
-
```yaml title="free-form text field"
79
+
```yaml title="Free-form text field"
46
80
- variable: anotherlabelvalue
47
81
label: AnImportantValue
48
82
description: Please enter this very important value
@@ -51,38 +85,34 @@ snippet shows an example option that accepts a user input string and validates i
51
85
validation: "^\w+{8,63}$"
52
86
```
53
87
54
-
## Accessing parameter values
88
+
---
55
89
56
-
The value of Parameters can be accessed in the rest of the resource definition. If you have worked
57
-
with [go templates](https://pkg.go.dev/text/template), this will be very familiar to you, but
58
-
even if you haven't it is quite simple. Values can be accessed in your teamplate using the `{{ .Values.
59
-
myvalue }}` notation -- where `myvalue` is the name of in the `variable` field of your
60
-
Parameters declaration.
90
+
## Access parameter values in templates
61
91
92
+
Access parameter values using Go template syntax:
62
93
63
94
```yaml title="accessing parameter values"
64
95
labels:
65
96
my-label: "{{ .Values.mylabelvalue }}"
66
97
```
67
98
68
-
## Parameter values
99
+
---
100
+
101
+
## Platform-specific parameter values
69
102
70
-
In addition to user created parameters, the platform controller always merges in some
71
-
platform-specific parameters that are also available to you. The available parameters differ
72
-
slightly depending on where you are deploying the resource associated with the template.
73
-
These values are behind the `vCluster Platform` key.
103
+
The platform also provides built-in parameter values based on the deployment context. These are available under the `loft` key:
0 commit comments