Skip to content

Commit

Permalink
NAS-118965 / 23.10 / Update documentation (truenas#998)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
stavros-k authored Apr 12, 2023
1 parent 3efd747 commit 42ea4d9
Show file tree
Hide file tree
Showing 12 changed files with 489 additions and 80 deletions.
79 changes: 42 additions & 37 deletions README.md

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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?

Expand All @@ -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.
Expand All @@ -67,27 +68,25 @@ 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

This section guides you through submitting an enhancement suggestion for an official application, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion :pencil: and find related suggestions :mag_right:.

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:
Expand All @@ -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
Expand All @@ -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
6 changes: 0 additions & 6 deletions disabled_updates.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
64 changes: 64 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -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 changes: 30 additions & 0 deletions docs/schema/boolean.md
Original file line number Diff line number Diff line change
@@ -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 changes: 28 additions & 0 deletions docs/schema/dict.md
Original file line number Diff line number Diff line change
@@ -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 changes: 38 additions & 0 deletions docs/schema/int.md
Original file line number Diff line number Diff line change
@@ -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` |
Loading

0 comments on commit 42ea4d9

Please sign in to comment.