Skip to content

Commit 4ea6e38

Browse files
authored
Update parameters
1 parent f394a2b commit 4ea6e38

File tree

1 file changed

+72
-42
lines changed

1 file changed

+72
-42
lines changed

platform/administer/templates/advanced/parameters.mdx

Lines changed: 72 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,63 @@ sidebar_label: Paramenters
44
sidebar_position: 2
55
---
66

7+
# Template parameters (UI workflow)
78

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.
1210

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:
1512

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
1762

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.
2164

2265
```yaml title="dialog box for user input"
2366
- variable: mylabelvalue
@@ -29,20 +72,11 @@ configuration as shown below, the user gets a dialog box where they can select '
2972
section: Labels
3073
```
3174

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.
4076

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:
4478

45-
```yaml title="free-form text field"
79+
```yaml title="Free-form text field"
4680
- variable: anotherlabelvalue
4781
label: AnImportantValue
4882
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
5185
validation: "^\w+{8,63}$"
5286
```
5387

54-
## Accessing parameter values
88+
---
5589

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
6191

92+
Access parameter values using Go template syntax:
6293

6394
```yaml title="accessing parameter values"
6495
labels:
6596
my-label: "{{ .Values.mylabelvalue }}"
6697
```
6798

68-
## Parameter values
99+
---
100+
101+
## Platform-specific parameter values
69102

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:
74104

75-
| Object | YAML Key | Value |
76-
| ----------------------- | ------------------------- | --------------------------------------------------------------------------------------------- |
77-
| Project | `project` | The name of the project that contains the space/virtualcluster the app is being deployed into |
78-
| Space | `space` | The name of the space (if applicable) the app is being deployed into |
79-
| VirtualCluster | `virtualClusterName` | The name of the virtual cluster (if applicable) the app is being deployed into |
80-
| Cluster | `cluster` | The name of the cluster the space/virtualcluster (and by extension the app) is in |
81-
| VirtualClusterNamespace | `virtualClusterNamespace` | The namespace the virtualcluster is in |
105+
| Context Object | Key | Description |
106+
| ----------------------- | ------------------------- | -------------------------------------------- |
107+
| Project | `project` | Name of the project that owns the deployment |
108+
| Space | `space` | Name of the space (if applicable) |
109+
| VirtualCluster | `virtualClusterName` | Name of the virtual cluster (if applicable) |
110+
| Cluster | `cluster` | Name of the physical Kubernetes cluster |
111+
| VirtualClusterNamespace | `virtualClusterNamespace` | Namespace of the virtual cluster |
82112

83-
With this you could access the `virtualClusterName` as follows:
113+
You can use them in your template:
84114

85-
```yaml title="accessing platform parameters"
115+
```yaml title="Accessing platform parameters"
86116
labels:
87117
my-label: "{{ .Values.loft.virtualClusterName }}"
88118
```

0 commit comments

Comments
 (0)