Pārlūkot izejas kodu

NAS-118965 / 23.10 / Update documentation (#998)

* update *.md formatting

* upgrade string schema

* add some extra fields

* add some extra options

* add int

* full variable expample

* add boolean

* expand

* add dict

* typo

* add list

* more docs

* add show_if operators

* change description

* add some notes
Stavros Kois 2 gadi atpakaļ
vecāks
revīzija
42ea4d99ed

+ 42 - 37
README.md

@@ -1,6 +1,6 @@
 <p align="center">
  <a href="https://discord.gg/Q3St5fPETd"><img alt="Join Discord" src="https://badgen.net/discord/members/Q3St5fPETd/?icon=discord&label=Join%20the%20TrueNAS%20Community" /></a>
- <a href="https://www.truenas.com/community/"><img alt="Join Forums" src="https://badgen.net/badge/Forums/Post%20Now//purple" /></a> 
+ <a href="https://www.truenas.com/community/"><img alt="Join Forums" src="https://badgen.net/badge/Forums/Post%20Now//purple" /></a>
  <a href="https://jira.ixsystems.com"><img alt="File Issue" src="https://badgen.net/badge/Jira/File%20Issue//red?icon=jira" /></a>
 </p>
 
@@ -12,11 +12,11 @@ A curated collection of TrueNAS SCALE enhanced Helm charts.
 
 A TrueNAS SCALE chart repository differs slightly in directory structure from upstream repos in that it includes an `app version` directory.
 
-A TrueNAS SCALE chart also has three additional files an `app-readme.md` file that provides a high level overview display in the TrueNAS SCALE UI and a `questions.yaml` file defining questions to prompt the user with and an `item.yaml` file outlining item specific details. 
+A TrueNAS SCALE chart also has three additional files an `app-readme.md` file that provides a high level overview display in the TrueNAS SCALE UI and a `questions.yaml` file defining questions to prompt the user with and an `item.yaml` file outlining item specific details.
 
 There are 2 directories `charts` and `test`, each representing a train. Chart releases created from catalog items in a specific train cannot be moved to another train. Currently only the `charts` train can be used inside the UI.
 
-```
+```shell
 charts/ix-chart/<chart version>/
   app-readme.md            # TrueNAS SCALE Specific: Readme file for display in TrueNAS SCALE UI
   charts/                  # Directory containing dependency charts
@@ -26,12 +26,13 @@ charts/ix-chart/<chart version>/
   templates/               # A directory of templates that, when combined with values.yml will generate K8s YAML
   values.yaml              # The default configuration values for this chart
 ```
-*See the upstream Helm chart [developer reference](https://helm.sh/docs/chart_template_guide/) for a complete walk through of developing charts.*
+
+_See the upstream Helm chart [developer reference](https://helm.sh/docs/chart_template_guide/) for a complete walk through of developing charts._
 
 To convert an upstream chart to take advantage of TrueNAS SCALE enhanced UX, first create an `item.yaml` file.
 This file among other catalog item information provides a list of categories that this chart fits into. This helps users navigate and filtering when browsing the catalog UI.
 
-```
+```shell
 $ cat charts/ix-chart/item.yaml
 categories:
   - generic
@@ -40,7 +41,7 @@ icon_url: "http://ix_url"
 
 After that create `app-readme.md` file.
 
-```
+```shell
 $ cat charts/ix-chart/<chart version>/app-readme.md
 
 # iX-Chart
@@ -51,7 +52,7 @@ It provides a mechanism to specify workload type, add external host interfaces i
 
 Then add a `questions.yaml` file to prompt the user for something.
 
-```
+```yaml
 groups:
   - name: "Container Images"
     description: "Image to be used for container"
@@ -93,37 +94,38 @@ questions:
 
 The above will prompt the user with 2 text fields and a dropdown in the UI getting details for image configuration in a helm chart.
 
-#### Question Variable Reference
-
-| Variable  | Type | Required | Description |
-| ------------- | ------------- | --- |------------- |
-| 	variable                    | string        | true       |  define the variable name specified in the `values.yaml`file. |
-| 	label                       | string        | true       |  define the UI label. |
-| 	description                 | string        | false      |  specify the description of the variable. |
-| 	group                       | string        | false      |  group questions by input value. |
-| 	schema                      | dictionary    | true       |  specify schema details for the `variable` |
-| 	schema.type                 | string        | true       |  specify type of value for `variable` (current supported types are string, int, boolean, path, hostpath, list, dict, ipaddr, and cron).|
-| 	schema.required             | bool          | false      |  define if the variable is required or not (true \ false), defaults to false |
-| 	schema.default              | object        | false      |  specify the default value. |
-| 	schema.min_length           | int           | false      |  min character length for string type variable.|
-| 	schema.max_length           | int           | false      |  max character length for string type variable.|
-| 	schema.min                  | int           | false      |  min integer length. |
-| 	schema.max                  | int           | false      |  max integer length. |
-| 	schema.enum                 | []dictionary  | false      |  specify the options when the variable type is `string`, for example, <br><br>enum:<br> - value: "RollingUpdate" <br>&nbsp;&nbsp;description: "Create new pods and then kill old ones"<br> - value: "Recreate"<br>&nbsp;&nbsp;description: "Kill existing pods before creating new ones"|
-| 	schema.valid_chars          | string        | false      |  regular expression for input chars validation. |
-| 	schema.subquestions         | []subquestion | false      |  add an array of subquestions.|
-| 	schema.show_if              | string        | false      | show current variable if condition specified is true, for example `show_if: [["workloadType", "=", "CronJob"]]` |
-| 	schema.show_subquestions_if | string        | false      | show subquestions if is true or equal to one of the options. for example `show_subquestion_if: "static"`. system will convert this to the filters format specifid for `shcema.show_if` automatically.|
-| 	schema.attrs                | []variables   | false      | specified when `schema.type` is dictionary to declare attributes allowed in the dictionary. |
-| 	schema.items                | []variables   | false      | specified when `schema.type` is list to declare attributes allowed in the list. |
-| 	schema.private              | bool          | false      | specified for declaring information sensitive fields. |
-| 	schema.null                 | bool          | false      | specifies if the value for the variable can be null. defaults to false. |
+### Question Variable Reference
+
+| Variable                    | Type          | Required | Description                                                                                                                                                                                                                                                                             |
+| --------------------------- | ------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| variable                    | string        | true     | define the variable name specified in the `values.yaml`file.                                                                                                                                                                                                                            |
+| label                       | string        | true     | define the UI label.                                                                                                                                                                                                                                                                    |
+| description                 | string        | false    | specify the description of the variable.                                                                                                                                                                                                                                                |
+| group                       | string        | false    | group questions by input value.                                                                                                                                                                                                                                                         |
+| schema                      | dictionary    | true     | specify schema details for the `variable`                                                                                                                                                                                                                                               |
+| schema.type                 | string        | true     | specify type of value for `variable` (current supported types are string, int, boolean, path, hostpath, list, dict, ipaddr, and cron).                                                                                                                                                  |
+| schema.required             | bool          | false    | define if the variable is required or not (true \ false), defaults to false                                                                                                                                                                                                             |
+| schema.default              | object        | false    | specify the default value.                                                                                                                                                                                                                                                              |
+| schema.min_length           | int           | false    | min character length for string type variable.                                                                                                                                                                                                                                          |
+| schema.max_length           | int           | false    | max character length for string type variable.                                                                                                                                                                                                                                          |
+| schema.min                  | int           | false    | min integer length.                                                                                                                                                                                                                                                                     |
+| schema.max                  | int           | false    | max integer length.                                                                                                                                                                                                                                                                     |
+| schema.enum                 | []dictionary  | false    | specify the options when the variable type is `string`, for example, <br><br>enum:<br> - value: "RollingUpdate" <br>&nbsp;&nbsp;description: "Create new pods and then kill old ones"<br> - value: "Recreate"<br>&nbsp;&nbsp;description: "Kill existing pods before creating new ones" |
+| schema.valid_chars          | string        | false    | regular expression for input chars validation.                                                                                                                                                                                                                                          |
+| schema.subquestions         | []subquestion | false    | add an array of subquestions.                                                                                                                                                                                                                                                           |
+| schema.show_if              | string        | false    | show current variable if condition specified is true, for example `show_if: [["workloadType", "=", "CronJob"]]`                                                                                                                                                                         |
+| schema.show_subquestions_if | string        | false    | show subquestions if is true or equal to one of the options. for example `show_subquestion_if: "static"`. system will convert this to the filters format specified for `shcema.show_if` automatically.                                                                                  |
+| schema.attrs                | []variables   | false    | specified when `schema.type` is dictionary to declare attributes allowed in the dictionary.                                                                                                                                                                                             |
+| schema.items                | []variables   | false    | specified when `schema.type` is list to declare attributes allowed in the list.                                                                                                                                                                                                         |
+| schema.private              | bool          | false    | specified for declaring information sensitive fields.                                                                                                                                                                                                                                   |
+| schema.null                 | bool          | false    | specifies if the value for the variable can be null. defaults to false.                                                                                                                                                                                                                 |
 
 **subquestions**: `subquestions[]` cannot contain `subquestions` or `show_subquestions_if` keys, but all other keys in the above table are supported. Also variables having `schema.type` list do not support `subquestions`.
 
 There are some novel cases where we would like to provide ability to configure / manage resources for workloads with getting some data from system dynamically.
 So a chart can specify certain actions to be performed by the system for a variable by defining a reference. An example better illustrates this concept:
-```
+
+```yaml
 - variable: volume
   label: "Volume"
   schema:
@@ -144,16 +146,18 @@ So a chart can specify certain actions to be performed by the system for a varia
           required: true
 ```
 
-In the above variable we define a `$ref` in schema which specifies that the system should take some action for normalising the value specified for the variable.
+In the above variable we define a `$ref` in schema which specifies that the system should take some action for normalizing the value specified for the variable.
 In this specific case, `ix_volume` is a concept introduced where we recommend using a volume which we are able to rollback automatically on chart release rollback. In essence,
 it is just a `hostPath` volume for which the system automatically creates the dataset specified.
 
 We have following types of actions supported in `$ref` right now:
-1) definitions
-2) normalize
+
+1. definitions
+2. normalize
 
 For (1), system will automatically update schema for a particular definition. For example,
-```
+
+```yaml
 - variable: hostInterface
   description: "Please specify host interface"
   label: "Host Interface"
@@ -163,6 +167,7 @@ For (1), system will automatically update schema for a particular definition. Fo
     $ref:
       - "definitions/interface"
 ```
+
 System will automatically populate available interfaces for the user based on what interfaces are available on the system.
 
 For (2), system will normalize values or perform some actions as discussed above.

+ 20 - 20
contributing.md

@@ -4,21 +4,22 @@
 
 The following is a set of guidelines for contributing to TrueNAS Official Catalog, which are hosted in the [TrueNAS Organization](https://github.com/truenas) on GitHub.
 
-#### Table Of Contents
+## Table Of Contents
 
 [Code of Conduct](#code-of-conduct)
 
 [I don't want to read this whole thing, I just have a question!!!](#i-dont-want-to-read-this-whole-thing-i-just-have-a-question)
 
 [What should I know before I get started?](#what-should-i-know-before-i-get-started)
-  * [Helm](#helm)
-  * [TrueNAS Compliant Catalog](#truenas-compliant-catalog)
+
+- [Helm](#helm)
+- [TrueNAS Compliant Catalog](#truenas-compliant-catalog)
 
 [How Can I Contribute?](#how-can-i-contribute)
-  * [Reporting Bugs](#reporting-bugs)
-  * [Suggesting Enhancements](#suggesting-enhancements-or-request-for-a-new-official-applications-to-be-included)
-  * [Contributing a New Official Application](#contributing-a-new-official-application)
 
+- [Reporting Bugs](#reporting-bugs)
+- [Suggesting Enhancements](#suggesting-enhancements-or-request-for-a-new-official-applications-to-be-included)
+- [Contributing a New Official Application](#contributing-a-new-official-application)
 
 ## Code of Conduct
 
@@ -30,7 +31,7 @@ This project and everyone participating in it is governed by the [TrueNAS Charts
 
 We have an official forum where the community chimes in with helpful advice if you have questions.
 
-* [TrueNAS Forum](https://www.truenas.com/community/)
+- [TrueNAS Forum](https://www.truenas.com/community/)
 
 ## What should I know before I get started?
 
@@ -41,9 +42,9 @@ helm charts.
 
 Here's a list of some useful helm resources to get started with:
 
-* [Getting Started with Helm](https://helm.sh/docs/chart_template_guide/getting_started/) - A basic guide explaining
+- [Getting Started with Helm](https://helm.sh/docs/chart_template_guide/getting_started/) - A basic guide explaining
 how to make helm charts
-* [Basic understanding of helm workflow](https://medium.com/bb-tutorials-and-thoughts/how-to-get-started-with-helm-b3babb30611f) -
+- [Basic understanding of helm workflow](https://medium.com/bb-tutorials-and-thoughts/how-to-get-started-with-helm-b3babb30611f) -
 A guide to understanding helm architecture and how helm charts operate.
 
 There are many more, but this list should be a good starting point.
@@ -67,19 +68,18 @@ be created, please follow the following guidelines when creating the issue.
 
 Explain the problem and include additional details to help maintainers reproduce the problem:
 
-* **Use a clear and descriptive title** for the issue to identify the problem.
-* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by
+- **Use a clear and descriptive title** for the issue to identify the problem.
+- **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by
 explaining how the problem occurs so that responsible developers working on it can reliably reproduce the issue to have
 it fixed in a timely fashion
-* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
-* **Explain which behavior you expected to see instead and why.**.
+- **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.
+- **Explain which behavior you expected to see instead and why.**.
 
 Provide more context by answering these questions:
 
-* **Did the problem start happening recently** (e.g. after updating to a new version of an official application) or was this always a problem?
-* If the problem started happening recently, **can you reproduce the problem in an older version of the application?** What's the most recent version in which the problem doesn't happen?
-* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
-
+- **Did the problem start happening recently** (e.g. after updating to a new version of an official application) or was this always a problem?
+- If the problem started happening recently, **can you reproduce the problem in an older version of the application?** What's the most recent version in which the problem doesn't happen?
+- **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.
 
 ### Suggesting Enhancements or request for a new Official Applications to be Included
 
@@ -87,7 +87,6 @@ This section guides you through submitting an enhancement suggestion for an offi
 
 Before creating enhancement suggestions, please check [this list](https://jira.ixsystems.com/browse/NAS-110314?jql=project%20%3D%20NAS%20AND%20issuetype%20%3D%20Suggestion) as you might find out that you don't need to create one.
 
-
 ### Contributing a New Official Application
 
 The workflow for adding a new official application is as follows:
@@ -98,7 +97,7 @@ The workflow for adding a new official application is as follows:
    3. Who will be maintaining the new application ?
 2. The TrueNAS team would get approval on the issue and based on that rest of the steps would be followed
 3. After (2) approval, create a PR [here](https://github.com/truenas/charts/pulls) adding the application to
-`community` train making sure that it complies with the [Official Catalog Application Standards](#Application-standards)
+  `community` train making sure that it complies with the [Official Catalog Application Standards](#application-standards)
 4. The application would be added to the community train after passing (3).
 
 Based on usage and utility, every few months the applications would be re-visited by the TrueNAS team and some
@@ -110,12 +109,13 @@ The application should conform to the following standards to be accepted in the
 
 1. Depending on usage, the app should have persistent storage either by using ix volumes or host path volumes.
 2. It should have a helm test to actually test to ensure that the application deploys and works nicely ( learn more
- about `helm test` [here](https://helm.sh/docs/topics/chart_tests/) or you can see an example 
+ about `helm test` [here](https://helm.sh/docs/topics/chart_tests/) or you can see an example
 [here](https://github.com/truenas/charts/blob/master/charts/nextcloud/1.5.0/templates/tests/deployment-check.yaml))
 3. It should have an upgrade strategy defined so that the application can be automatically updated whenever a docker
 image it consumes has a newer tag available. For details please see this tool which is used to automatically
 allow automated upgrades [TrueNAS Catalog Update](https://github.com/truenas/catalog_update).
 
 Before the application can be accepted, it must pass our CI tests which comprise the following checks:
+
 1. Validation of the catalog itself i.e [TrueNAS Catalog Validation](https://github.com/truenas/catalog_validation)
 2. Application in question being deployed in the CI and ensuring it's `helm test` succeeds

+ 0 - 6
disabled_updates.md

@@ -1,11 +1,5 @@
 # Apps with temporary disabled updates
 
-- MinIO
-
-Latest updates removed a component that allows it to run in standalone modes, affecting existing installations.
-We need to check how the migration will be happening before resuming updates
-Last version that works as standalone: `RELEASE.2022-10-24T18-35-07Z`
-
 - StorJ
 
 Latest updates are marked as pre-release (1.67.x). We need to look again once the releases are no longer marked

+ 64 - 0
docs/README.md

@@ -0,0 +1,64 @@
+# Questions.yaml structure
+
+This file have some top level attributes:
+
+- Groups
+- Portals
+- Questions
+
+## Groups
+
+Groups can be defined to "group" questions together. This is useful when you have a lot of questions and want to split them into logical groups.
+
+```yaml
+groups:
+  - name: "Group 1"
+    description: "Description of group 1"
+  - name: "Group 2"
+    description: "Description of group 2"
+```
+
+- `name` is what will be used to reference the group in the `questions.yaml` file.
+- `description` is a what will be displayed in the UI.
+
+> Groups can only be referenced by the top level variables in `questions` attribute.
+
+## Portals
+
+Portals can be defined to display a button on the UI that will open a new tab to a specific URL.
+
+```yaml
+portals:
+  button_name:
+    protocols:
+      - https
+    host:
+      - example.com
+    ports:
+      - 443
+    path: /path/to/something
+```
+
+> You can define more than 1 portal. But the name of the portal must be unique.
+
+Portals support some variables that can be used to dynamically generate the URL.
+
+- `$variable-VARIABLE_NAME.NESTED_VARIABLE_NAME` will be replaced by the value of the variable `NESTED_VARIABLE_NAME` under the variable `VARIABLE_NAME`.
+  (Variables are defined in the `questions` attribute)
+- `$kubernetes-resource_configmap.RESOURCE_NAME.RESOURCE_KEY` will be replaced by the value of the key `RESOURCE_KEY` in the configmap named `RESOURCE_NAME`.
+- `$node_ip` will be replaced by the IP of the node where the app is running.
+
+## Questions
+
+Questions are the main attribute of the `questions.yaml` file. It is used to define the questions that will be displayed in the UI.
+
+```yaml
+questions:
+  - variable: variable_name
+    label: Friendly Name
+    group: "Group 1"
+    description: "Description of the variable"
+    schema:
+      type: string
+      default: "something"
+```

+ 30 - 0
docs/schema/boolean.md

@@ -0,0 +1,30 @@
+# Boolean Schema
+
+## Example of boolean schema options
+
+```yaml
+- variable: boolean_variable
+  label: Boolean Variable
+  description: Description of boolean variable
+  schema:
+    type: boolean
+    required: true
+    editable: true
+    immutable: true
+    hidden: true
+    default: true
+```
+
+Following attributes can be added to `boolean` schema to enforce validation when a chart release is being created/edited:
+Those attributes are set in the schema during the chart development and are not user configurable.
+
+| Attribute              |     Type     | Default | Description                                                                                                                                                                                                             |
+| :--------------------- | :----------: | :-----: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `immutable`            |  `boolean`   | `false` | When set to true, the value of this variable cannot be changed after the chart is installed.                                                                                                                            |
+| `required`             |  `boolean`   | `false` | When set to true, the value of this variable is required to be set to `true`, Useful when user is required to "accept" terms of use for example.                                                                        |
+| `editable`             |  `boolean`   | `false` | When set to true, the value of this variable cannot be edited by the user. Useful if you want a user to see the value but not be able to edit.                                                                          |
+| `hidden`               |  `boolean`   | `false` | When set to true, this variable is is hidden from the user.                                                                                                                                                             |
+| `default`              |  `boolean`   | `false` | When set to a boolean, the value of this variable will be set to the specified value by default.                                                                                                                        |
+| `show_if`              | `expression` |  unset  | When set to an [expression](show_if.md#expression-syntax) that evaluates to true, it will make the variable visible and effective. If it evaluates to false, it will be hidden and it won't be passed to the helm chart |
+| `show_subquestions_if` |  `boolean`   |  unset  | When set to a value and the parent value matches, it will show the subquestions. Note that subquestion variables will be passed to the helm chart on the same level as the "parent" variable. It won't be nested.       |
+| `subquestions`         |    `dict`    |  unset  | Define subquestion variables, following the usual schema per type, only difference is that you **can't** define `show_subquestions_if` under `subquestions`                                                             |

+ 28 - 0
docs/schema/dict.md

@@ -0,0 +1,28 @@
+# Dict Schema
+
+## Example of dict schema options
+
+```yaml
+- variable: dict_variable
+  label: Dict Variable
+  description: Description of dict variable
+  schema:
+    type: dict
+    additional_attrs: true
+    show_if: [[ "some_variable", "=", "some_value" ]]
+    attrs:
+      - variable: string_variable
+        label: String Variable
+        description: Description of string variable
+        schema:
+          type: string
+```
+
+Following attributes can be added to `dict` schema to enforce validation when a chart release is being created/edited:
+Those attributes are set in the schema during the chart development and are not user configurable.
+
+| Attribute          |     Type     | Default | Description                                                                                                                                                                                                             |
+| :----------------- | :----------: | :-----: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `additional_attrs` |  `boolean`   | `false` | When set to `true`, allows additional variables to be added.                                                                                                                                                            |
+| `attrs`            |    `dict`    |  unset  | Define variables within the dict                                                                                                                                                                                        |
+| `show_if`          | `expression` |  unset  | When set to an [expression](show_if.md#expression-syntax) that evaluates to true, it will make the variable visible and effective. If it evaluates to false, it will be hidden and it won't be passed to the helm chart |

+ 38 - 0
docs/schema/int.md

@@ -0,0 +1,38 @@
+# Int Schema
+
+## Example of int schema options
+
+```yaml
+- variable: int_variable
+  label: Int Variable
+  description: Description of int variable
+  schema:
+    type: int
+    required: true
+    editable: true
+    immutable: true
+    hidden: true
+    "null": true
+    min: 5
+    max: 12
+    valid_chars: "[0-9]{3}"
+    default: 10
+```
+
+Following attributes can be added to `int` schema to enforce validation when a chart release is being created/edited:
+Those attributes are set in the schema during the chart development and are not user configurable.
+
+| Attribute              |     Type     | Default | Description                                                                                                                                                                                                             |
+| :--------------------- | :----------: | :-----: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `immutable`            |  `boolean`   | `false` | When set to true, the value of this variable cannot be changed after the chart is installed.                                                                                                                            |
+| `required`             |  `boolean`   | `false` | When set to true, the value of this variable is required and cannot be empty.                                                                                                                                           |
+| `editable`             |  `boolean`   | `false` | When set to true, the value of this variable cannot be edited by the user. Useful if you want a user to see the value but not be able to edit.                                                                          |
+| `hidden`               |  `boolean`   | `false` | When set to true, this variable is is hidden from the user.                                                                                                                                                             |
+| `"null"`               |  `boolean`   | `false` | When set to true, this variable can be `null`.                                                                                                                                                                          |
+| `min`                  |  `integer`   |  unset  | When set to a value greater than 0, the value of this variable cannot be smaller than the specified number.                                                                                                             |
+| `max`                  |  `integer`   |  unset  | When set to a value greater than 0, the value of this variable larger than the specified number.                                                                                                                        |
+| `valid_chars`          |   `string`   |  unset  | When set to a regex, the value of this variable must conform to the specified regex. Underneath the [Python3 Regex Library](https://docs.python.org/3/library/re.html) is used.                                         |
+| `default`              |    `int`     |  unset  | When set to an int, the value of this variable will be set to the specified value by default.                                                                                                                           |
+| `show_if`              | `expression` |  unset  | When set to an [expression](show_if.md#expression-syntax) that evaluates to true, it will make the variable visible and effective. If it evaluates to false, it will be hidden and it won't be passed to the helm chart |
+| `show_subquestions_if` |    `int`     |  unset  | When set to a value and the parent value matches, it will show the subquestions. Note that subquestion variables will be passed to the helm chart on the same level as the "parent" variable. It won't be nested.       |
+| `subquestions`         |    `dict`    |  unset  | Define subquestion variables, following the usual schema per type, only difference is that you **can't** define `show_subquestions_if` under `subquestions`                                                             |

+ 48 - 0
docs/schema/list.md

@@ -0,0 +1,48 @@
+# List Schema
+
+## Example of list schema options
+
+```yaml
+- variable: list_variable
+  label: List Variable
+  description: Description of list variable
+  schema:
+    type: list
+    show_if: [["some_variable", "=", "some_value"]]
+    default: ["value1", "value2"]
+    # Single Variable (Passed to helm chart as a list of strings (or the type defined))
+    items:
+      - variable: string_variable
+        label: String Variable
+        description: Description of string variable
+        schema:
+          type: string
+    # Dicts (Passed to helm chart as a list of dicts)
+    items:
+      - variable: dict_variable
+        label: Dict Variable
+        description: Description of dict variable
+        schema:
+          type: dict
+          attrs:
+            # Dict can have one or more variables
+            - variable: string_variable
+              label: String Variable
+              description: Description of string variable
+              schema:
+                type: string
+            - variable: int_variable
+              label: Int Variable
+              description: Description of int variable
+              schema:
+                type: int
+```
+
+Following attributes can be added to `list` schema to enforce validation when a chart release is being created/edited:
+Those attributes are set in the schema during the chart development and are not user configurable.
+
+| Attribute |     Type     | Default | Description                                                                                                                                                                                                                                |
+| :-------- | :----------: | :-----: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `show_if` | `expression` |  unset  | When set to an [expression](show_if.md#expression-syntax) that evaluates to true, it will make the variable visible and effective. If it evaluates to false, it will be hidden and it won't be passed to the helm chart                    |
+| `default` |    `list`    |  unset  | A default list of items can be defined in a `json` format. Single variable, multiple values: `["value1", "value2"]`. Dict variable, Multiple variables: `[{"var1": "val1", "var2": "val2"}, {"var1": "other_val1", "var2": "other_val2"}]` |
+| `items`   |    `dict`    |  unset  | Define variables within the dict. This is like a template. Each time user clicks "Add" a form containing the defined variables will be presented                                                                                           |

+ 133 - 0
docs/schema/ref/README.md

@@ -0,0 +1,133 @@
+# $ref
+
+Key `$ref` can be defined under `schema`. It's used to fetch values from the host system API.
+
+Supported actions:
+
+- Definitions
+- Normalize
+
+## Definitions
+
+### Timezone
+
+This will populate a drop down menu of timezones.
+
+```yaml
+- variable: timezone
+  label: Configure timezone
+  group: Configuration
+  description: "Configure timezone"
+  schema:
+    type: string
+    $ref:
+      - "definitions/timezone"
+```
+
+This returns a string with the timezone name. For example `America/New_York`.
+
+### Interface
+
+This will populate a drop down menu of network interfaces.
+
+```yaml
+- variable: interface
+  label: Configure network interface
+  group: Configuration
+  description: "Configure network interface"
+  schema:
+    type: string
+    $ref:
+      - "definitions/interface"
+```
+
+This returns a string with the interface name. For example `eth0`.
+
+### GPU
+
+This will populate a drop down menu of GPU configurations.
+
+```yaml
+- variable: interface
+  label: Configure network interface
+  group: Configuration
+  description: "Configure network interface"
+  schema:
+    type: dict
+    $ref:
+      - "definitions/gpuConfiguration"
+```
+
+This will return a dict with the following format:
+
+```yaml
+gpuConfiguration:
+  nvidia.com/gpu: "1"
+```
+
+### Node IP
+
+This will populate with the IP of the node where the app is running.
+
+```yaml
+- variable: host
+  label: "Node IP"
+  schema:
+    type: string
+    $ref:
+      - "definitions/nodeIP"
+```
+
+### Certificate
+
+This will populate the drop down menu with the certificates that are available in the host system.
+
+```yaml
+- variable: certificate
+  label: "Certificate"
+  schema:
+    type: int
+    $ref:
+      - "definitions/certificate"
+```
+
+This will return an integer with the certificate ID.
+You can use this ID to get certificate values from `.Values.ixCertificates`.
+Format:
+
+```yaml
+ixCertificates:
+  "1":
+    privatekey: |
+      -----BEGIN PRIVATE KEY-----
+      ........................
+      -----END PRIVATE KEY-----
+    certificate: |
+      -----BEGIN CERTIFICATE-----
+      ........................
+      -----END CERTIFICATE-----
+    ...
+```
+
+## Normalize
+
+### ixVolume
+
+```yaml
+- variable: datasetName
+  label: "Configuration Volume Dataset Name"
+  schema:
+    type: string
+    default: config
+    $ref:
+      - "normalize/ixVolume"
+```
+
+Defining a value here (eg. `config`) will instruct API to create a "volume" in the user configured ix-application dataset.
+Then within the helm chart you can search in `.Values.ixVolumes` for the dataset name and get the mount point.
+`.Values.ixVolumes` is a list of dicts with the following format:
+
+```yaml
+ixVolumes:
+  - hostPath: /mnt/POOL/ix-applications/APP/DATASET_NAME
+```

+ 40 - 0
docs/schema/show_if.md

@@ -0,0 +1,40 @@
+# Show if
+
+`show_if` can only access variables that are defined in the same level as the variable that has `show_if` defined.
+
+## Expression syntax
+
+`[[ "variable_name", "operator", "value" ]]`
+
+| Operator | Description                                                     | Example                                  |
+| :------: | :-------------------------------------------------------------- | :--------------------------------------- |
+|   `=`    | Value of `variable_name` is equal to "value"                    | `[[ "variable_name", "=", "value" ]]`    |
+|   `!=`   | Value of `variable_name` is not equal to "value"                | `[[ "variable_name", "!=", "value" ]]`   |
+|   `>`    | Value of `variable_name` is greater than "value"                | `[[ "variable_name", ">", "10" ]]`       |
+|   `>=`   | Value of `variable_name` is greater or equal to "value"         | `[[ "variable_name", ">=", "10" ]]`      |
+|   `<`    | Value of `variable_name` is less than "value"                   | `[[ "variable_name", "<", "10" ]]`       |
+|   `<=`   | Value of `variable_name` is less or equal than "value"          | `[[ "variable_name", "<=", "10" ]]`      |
+|   `in`   | Value of `variable_name` is contained in "value"                | `[[ "variable_name", "in", "value" ]]`   |
+|  `nin`   | Value of `variable_name` is **not** contained in "value"        | `[[ "variable_name", "nin", "value" ]]`  |
+|  `rin`   | Value of `variable_name` includes "value"                       | `[[ "variable_name", "rin", "value" ]]`  |
+|  `rnin`  | Value of `variable_name` does **not** include "value"           | `[[ "variable_name", "rnin", "value" ]]` |
+|   `^`    | Value of `variable_name` starts with "value"                    | `[[ "variable_name", "^", "value" ]]`    |
+|   `!^`   | Value of `variable_name` does not start with "value"            | `[[ "variable_name", "!^", "value" ]]`   |
+|   `$`    | Value of `variable_name` ends with "value"                      | `[[ "variable_name", "$", "value" ]]`    |
+|   `!$`   | Value of `variable_name` does not end with "value"              | `[[ "variable_name", "!$", "value" ]]`   |
+|   `~`    | Value of `variable_name` matches the regular expression "value" | `[[ "variable_name", "~", "value" ]]`    |
+
+Examples:
+
+```yaml
+- variable: variable1
+  label: Variable 1
+  schema:
+    type: string
+    default: "some value"
+- variable: variable2
+  label: Variable 2
+  schema:
+    type: string
+    show_if: [["variable2", "=", "some value"]]
+```

+ 45 - 16
docs/schema/string.md

@@ -1,28 +1,57 @@
-## String Schema
+# String Schema
 
+## Example of string schema options
 
-#### Example of string schema options:
-```
-schema:
+```yaml
+- variable: string_variable
+  label: String Variable
+  description: Description of string variable
+  schema:
     type: string
     private: true
+    required: true
+    editable: true
+    immutable: true
+    hidden: true
     min_length: 5
     max_length: 12
+    default: "default_value"
     valid_chars: "[a-zA-Z0-9]$"
+    enum:
+      - value: "value1"
+        description: "Description of value1"
+    show_if: [["variable1", "=", "some value"]]
+    show_subquestions_if: "value1"
+    subquestions:
+      - variable: subquestion1
+        label: Subquestion 1
+        schema:
+          type: string
+          required: true
 ```
 
-Following attributes can be added to string schema to enforce validation when a chart release is being created/edited:
-
-`min_length` is an integer field which adds validation to ensure value provided for this variable is at least the specified
-characters.
+Following attributes can be added to `string` schema to enforce validation when a chart release is being created/edited:
+Those attributes are set in the schema during the chart development and are not user configurable.
 
-`max_length` is an integer field which adds validation to ensure value provided for this variable is at max the specified
-characters.
+| Attribute              |     Type     | Default | Description                                                                                                                                                                                                             |
+| :--------------------- | :----------: | :-----: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `immutable`            |  `boolean`   | `false` | When set to true, the value of this variable cannot be changed after the chart is installed.                                                                                                                            |
+| `private`              |  `boolean`   | `false` | When set to true, each character of the value will appear as `*` in the UI. Useful for sensitive fields like passwords.                                                                                                 |
+| `required`             |  `boolean`   | `false` | When set to true, the value of this variable is required and cannot be empty.                                                                                                                                           |
+| `editable`             |  `boolean`   | `false` | When set to true, the value of this variable cannot be edited by the user. Useful if you want a user to see the value but not be able to edit.                                                                          |
+| `hidden`               |  `boolean`   | `false` | When set to true, this variable is is hidden from the user. Useful if you want to set a value that is populated from a `$ref` during the installation, but you don't want user to see the field.                        |
+| `min_length`           |  `integer`   |  unset  | When set to a value greater than 0, the value of this variable must be at least the specified characters.                                                                                                               |
+| `max_length`           |  `integer`   |  unset  | When set to a value greater than 0, the value of this variable must be at most the specified characters.                                                                                                                |
+| `valid_chars`          |   `string`   |  unset  | When set to a regex, the value of this variable must conform to the specified regex. Underneath the [Python3 Regex Library](https://docs.python.org/3/library/re.html) is used.                                         |
+| `default`              |   `string`   |  unset  | When set to a string, the value of this variable will be set to the specified value by default.                                                                                                                         |
+| `enum`                 |   `array`    |  unset  | When set to an array of objects, the `value` of this variable must be one of the specified values. UI will have a dropdown with the values defined. `description` is what the user will see.                            |
+| `show_if`              | `expression` |  unset  | When set to an [expression](show_if.md#expression-syntax) that evaluates to true, it will make the variable visible and effective. If it evaluates to false, it will be hidden and it won't be passed to the helm chart |
+| `show_subquestions_if` |   `string`   |  unset  | When set to a value and the parent value matches, it will show the subquestions. Note that subquestion variables will be passed to the helm chart on the same level as the "parent" variable. It won't be nested.       |
+| `subquestions`         |    `dict`    |  unset  | Define subquestion variables, following the usual schema per type, only difference is that you **can't** define `show_subquestions_if` under `subquestions`                                                             |
 
-`private` is a boolean field which when set by chart maintainer, will result in the value of the variable not being
-shown to the user in the UI. This is useful for sensitive fields like password where a dummy character is placed for
-each character provided for this string in the UI.
+## Notes
 
-`valid_chars` is a string field which chart maintainer can specify to provide a regex to enforce that the value provided
-for the variable should conform to a pattern. TrueNAS Scale will use python3 regex (https://docs.python.org/3/library/re.html)
-syntax to enforce `valid_chars`.
+- Having `required` set to true and an enum with empty `value` will not allow the user to save the form.
+- Having `required` set to true and `editable` set to false will not allow the user to save the form.
+- Having `editable` set to true and `immutable` set to true will only allow the user to edit the value once. (Same as `immutable` alone)
+- Having `hidden` set to true, `required` set to true and `default` without a value will not allow the user to save the form.

+ 1 - 1
docs/upgrade.md

@@ -21,7 +21,7 @@ For such custom scenarios, TrueNAS SCALE allows to stop workloads specifically
 before a snapshot is taken of an application's volumes. Workloads in this case can
 add the following annotation to the deployment/statefulset:
 
-```
+```yaml
 "ix.upgrade.scale.down.workload": true
 ```